-
Notifications
You must be signed in to change notification settings - Fork 67
/
build.sh
executable file
·67 lines (53 loc) · 1.22 KB
/
build.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
62
63
64
65
66
67
#!/bin/bash
SSH_REPO="kodi.sharkbits.com:/home/kodi/www"
cd "${0%/*}"
do_build=
do_upload=
usage()
{
echo "${0##*/} [-b] [-u] [repo]"
exit 1
}
help()
{
echo "${0##*/} [-b] [-u] [repo]"
echo
echo "Where -b for build, -u for upload, repo name"
echo "Default -b -u filmkodi"
exit 0
}
[[ "$1" = "--help" ]] && help
while getopts ":bu" opt; do
case "${opt}" in
b) do_build=y ;;
u) do_upload=y ;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
# default
repo="${1:-filmkodi}"
out="./out/$repo"
if [[ ! "$do_build" && ! "$do_upload" ]]; then
do_build=y
do_upload=y
fi
mkdir -p "$out"
if [[ "$do_build" = y ]]; then
./addon_generator.py "$repo"
while read addon ver; do
if [[ -s "$out/$addon/$addon-$ver.zip" ]]; then
echo "--- [ $addon // $ver ] ... already exists. Skipping."
else
echo "--- [ $addon // $ver ]"
mkdir -p "$out/$addon"
zip -r "$out/$addon/$addon-$ver.zip" "$addon" -x '*.pyc' '*.pyo' '*/core' '*/.*.sw?' '*/.git' '*/.git/*'
fi
done <<< $(awk '/<addon id=/ { print(gensub("^.* id=\"([^\"]*)\".* version=\"([^\"]*)\".*$", "\\1 \\2", 1))}' "$out/addons.xml")
fi
if [[ "$do_upload" = y ]]; then
#scp -P 5551 -r $out/* $SSH_REPO/$repo/
rsync -aPe 'ssh -p 5551' $out/ $SSH_REPO/$repo/
fi