-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_common.sh
61 lines (46 loc) · 1.16 KB
/
_common.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
git_clone_repo() {
[[ -v SRC && -v TAG && -v BUILDNAME ]] || return 1
mkdir -p repos && cd repos || return
echo "==> git clone into ./repos: $SRC"
git clone -b "$TAG" --depth=1 "$SRC" "$BUILDNAME"
cd ..
}
build_container() {
[[ -v BUILDNAME ]] || return 1
docker build -t crxbuilder:"$BUILDNAME" "repos/$BUILDNAME" | tee /dev/tty | tail -1 | cut -d' ' -f3
}
get_repo_path() {
[[ -v BUILDNAME ]] || return 1
echo "$(pwd)/repos/$BUILDNAME"
}
create_build_path() {
[[ -v BUILDNAME ]] || return 1
rm -rf "build/$BUILDNAME"
mkdir -p "build/$BUILDNAME"
echo "$(pwd)/build/$BUILDNAME"
}
create_dist_path() {
[[ -v BUILDNAME ]] || return 1
rm -rf "dist/$BUILDNAME"
mkdir -p "dist/$BUILDNAME"
echo "$(pwd)/dist/$BUILDNAME"
}
at_repo() {
cd "$(get_repo_path)" || return 1
}
pack_by_chromium() {
[[ -v BUILDNAME ]] || return 1
mkdir -p dist && cd dist || return 1
rm -rf "$BUILDNAME."crx
if [ -f "$BUILDNAME.pem" ]; then
chromium --pack-extension="$BUILDNAME" --pack-extension-key="$BUILDNAME.pem"
else
chromium --pack-extension="$BUILDNAME"
fi
cd ..
}
print_builder() {
[[ -v BUILDNAME ]] || return 1
echo "==> $BUILDNAME new container: $1"
}