-
Notifications
You must be signed in to change notification settings - Fork 3
/
create_addon
executable file
·66 lines (52 loc) · 1.96 KB
/
create_addon
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
#!/bin/sh
. packages/meta
echo "Building $PKG_NAME-$PKG_VERSION.$PKG_REV"
rm -rf target/$PKG_VERSION.$PKG_REV/
rm -rf build
mkdir -p build/stamps
cp -rf $PKG_NAME build/$PKG_NAME
rm -f build/$PKG_NAME/*/.gitignore
for i in $PKG_DEPENDS;do
if [ ! -f build/stamps/$i ]; then
mkpkg/mkpkg_$i
if [ "$?" -ne "0" ]; then
echo "Error building $i";exit 1
fi
fi
done
mkdir -p target/$PKG_VERSION.$PKG_REV/
cd build
zip -rq9y ../target/$PKG_VERSION.$PKG_REV/$PKG_NAME-$PKG_VERSION.$PKG_REV.zip $PKG_NAME
if [ "$?" -ne "0" ]; then
echo "Error building $PKG_NAME";exit 1
fi
md5sum ../target/$PKG_VERSION.$PKG_REV/$PKG_NAME-$PKG_VERSION.$PKG_REV.zip | awk '{print $1}' > ../target/$PKG_VERSION.$PKG_REV/$PKG_NAME-$PKG_VERSION.$PKG_REV.zip.md5
if [ "$?" -ne "0" ]; then
echo "Error building $PKG_NAME";exit 1
fi
ICON=$(cat $PKG_NAME/addon.xml | grep -oPm1 "(?<=<icon>)[^<]+")
if [ -f $PKG_NAME/$ICON ]; then
mkdir -p ../target/$PKG_VERSION.$PKG_REV/$(dirname $ICON) && cp $PKG_NAME/$ICON ../target/$PKG_VERSION.$PKG_REV/$ICON
fi
FANART=$(cat $PKG_NAME/addon.xml | grep -oPm1 "(?<=<fanart>)[^<]+")
if [ -f $PKG_NAME/$FANART ]; then
mkdir -p ../target/$PKG_VERSION.$PKG_REV/$(dirname $FANART) && cp $PKG_NAME/$FANART ../target/$PKG_VERSION.$PKG_REV/$FANART
fi
SCREENSHOTS=$(cat $PKG_NAME/addon.xml | grep -oP "(?<=<screenshot>)[^<]+")
for SCREENSHOT in $SCREENSHOTS; do
if [ -f $PKG_NAME/$SCREENSHOT ]; then
mkdir -p ../target/$PKG_VERSION.$PKG_REV/$(dirname $SCREENSHOT) && cp $PKG_NAME/$SCREENSHOT ../target/$PKG_VERSION.$PKG_REV/$SCREENSHOT
fi
done
cp $PKG_NAME/changelog.txt ../target/$PKG_VERSION.$PKG_REV/changelog-$PKG_VERSION.$PKG_REV.txt
cp $PKG_NAME/addon.xml ../target/$PKG_VERSION.$PKG_REV/addon.xml
cd ..
rm -rf build
echo "###FILENAME###"
echo "$PKG_NAME/target/$PKG_VERSION.$PKG_REV/$PKG_NAME-$PKG_VERSION.$PKG_REV.zip"
if NEWS=$(cat target/$PKG_VERSION.$PKG_REV/addon.xml | grep -oP "(?<=<news>)[^<]+");then
echo "###NEWS###"
echo $NEWS
fi
echo ""
exit 0