-
Notifications
You must be signed in to change notification settings - Fork 17
/
update.sh
75 lines (66 loc) · 2.7 KB
/
update.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
68
69
70
71
72
73
74
#!/bin/bash
DEVROOT="/mnt/d/github/"
ROOT="/mnt/d/github/my-kodi-repo"
DIRS=("repositories" "krypton" "leia" "matrix")
ZIP="$(command -v zip)"
if [ "$ZIP" = "" ]
then
echo "zip missing. eg: apt-get install zip"
exit 0
fi
generate_repo() {
echo ""
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' >addons.xml
echo '<addons>' >> addons.xml
for name in $(find . -maxdepth 1 -type d | grep -v \.git | grep -v addons | egrep -v "^\.$" | cut -d \/ -f 2); do
if [ -f "$name/addon.xml" ]; then
VERSION=$(cat $name/addon.xml | sed '/?xml/d' | sed '/<import/d' | grep version= | sed -n 1p | sed 's/.*version="\([^"]*\)"*.*/\1/g')
if [ ! -f "$name/$name-$VERSION.zip" ]; then
rm *.zip >/dev/null 2>&1
echo "Create: $kodibuild/$name-$VERSION.zip"
zip -r "$name/$name-$VERSION.zip" "$name" -x -x \*.git -x \*.psd -x \*.pyo -x \*.pyc -x \*.mo -x \*.gitignore >/dev/null 2>&1
echo ""
fi
find "$name" ! \( -name "addon.xml" -o -name "*.zip" -o -name "fanart.jpg" -o -name "icon.png" -o -name "screenshot*.*" \) -delete >/dev/null 2>&1
echo "Add: $name $VERSION"
echo ""
cat "$name"/addon.xml|grep -v "<?xml " >> addons.xml
echo "" >> addons.xml
fi
done
echo "</addons>" >> addons.xml
md5sum addons.xml > addons.xml.md5
}
echo ""
echo "░█▀▄░█▀▀░█▀█░█▀█░░░█░█░█▀█░█▀▄░█▀█░▀█▀░█▀▀░█▀▄"
echo "░█▀▄░█▀▀░█▀▀░█░█░░░█░█░█▀▀░█░█░█▀█░░█░░█▀▀░█▀▄"
echo "░▀░▀░▀▀▀░▀░░░▀▀▀░░░▀▀▀░▀░░░▀▀░░▀░▀░░▀░░▀▀▀░▀░▀"
echo ""
echo ""
if [ ! "$1" = "" ] && [ ! "$2" == "" ]
then
read -p "Are you sure you want to copy and replace '$1'?"
mkdir "$ROOT/$2" >/dev/null 2>&1
rm -rf "$ROOT/$2/$1"
rsync -av --exclude ".git" --exclude ".git*" --exclude "*.psd" "$DEVROOT/$1" "$ROOT/$2"
fi
for kodibuild in "${DIRS[@]}"; do
echo $kodibuild
if [ -d "$ROOT/$kodibuild" ]; then
echo ""
cd "$ROOT/$kodibuild"
generate_repo
echo "-------------------"
echo ""
fi
done
read -p "Press enter to push to GitHub"
cd "$ROOT"
git add .
git checkout --orphan new-master master
git commit -m "update"
git branch -M new-master master
git gc --aggressive --prune=now
git push -f
echo ""
read -p "Done. Press enter to quit"