-
Notifications
You must be signed in to change notification settings - Fork 16
/
linux.builtin.sh
executable file
·76 lines (67 loc) · 1.7 KB
/
linux.builtin.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
75
76
#!/bin/sh
OLD="https:\/\/cdnjs.cloudflare.com\/ajax"
NEW="unauthenticated"
FILES="*.cgi"
TGDIR="./upload/filemin"
DISTR="./upload"
mkdir -p $TGDIR
mkdir -p $TGDIR/unauthenticated
mkdir -p $TGDIR/unauthenticated/js
mkdir -p $TGDIR/unauthenticated/css
mkdir -p $TGDIR/unauthenticated/templates
cp -R images $TGDIR
cp -R lang $TGDIR
cp -R lib $TGDIR
cp -R unauthenticated/libs $TGDIR/unauthenticated
cp -R unauthenticated/css/*.min.css $TGDIR/unauthenticated/css
cp filemin-updater.tar.gz $TGDIR/unauthenticated
cp CHANGELOG.md $TGDIR
cp LICENCE $TGDIR
cp README.md $TGDIR
cp acl_security.pl $TGDIR
# cp postinstall.pl $TGDIR
# cp uninstall.pl $TGDIR
cp config $TGDIR
cp config.info $TGDIR
cp defaultacl $TGDIR
cp filemin-lib.pl $TGDIR
sed -e "s/flavour=full/flavour=builtin/g" "module.info" > "$TGDIR/module.info"
for f in $FILES
do
if [ -f $f -a -r $f ]; then
cp $f "$TGDIR/$f"
else
echo "Error: Cannot read $f"
fi
done
FILES="unauthenticated/templates/*.html"
for f in $FILES
do
if [ -f $f -a -r $f ]; then
sed -e "s/$OLD/$NEW/g" -e "s/filemin\./filemin\.min\./g" -e "s/chmod-calculator\./chmod-calculator\.min\./g" -e "s/spec-ops\./spec-ops\.min\./g" "$f" > "$TGDIR/$f"
else
echo "Error: Cannot read $f"
fi
done
FILES="unauthenticated/js/*.min.js"
for f in $FILES
do
if [ -f $f -a -r $f ]; then
sed "s/$OLD/$NEW/g" "$f" > "$TGDIR/$f"
else
echo "Error: Cannot read $f"
fi
done
while IFS='=' read -r key value; do
case $key in
version)
VERSION="$value"
;;
esac
done < module.info
echo "Packing Linux builtin version $VERSION"
mv -f $TGDIR/filemin.cgi $TGDIR/index.cgi
cd $DISTR
tar -zcf filemin-$VERSION.linux.builtin.wbm.gz filemin
cd ../
rm -rf $TGDIR