forked from m-parashar/adblock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
createinstaller.sh
44 lines (33 loc) · 1.15 KB
/
createinstaller.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
#!/bin/sh
echo "> Creating archive for installation"
cd /jffs/dnsmasq
rm adblock.tar.gz
rm install-adblock.sh
tar czvf adblock.tar.gz README adblock.sh cacert.pem mpdomains mphosts
echo "> Generating installer stub"
cat << 'EOF' > install-adblock.sh
#!/bin/sh
echo "======================================================"
echo "| Installing adblock for DD-WRT |"
echo "| https://github.com/m-parashar/adblock |"
echo "| Copyright $PRY Manish Parashar |"
echo "======================================================"
# Create destination folder
DESTINATION="/jffs/dnsmasq"
mkdir -p ${DESTINATION}
# Find __ARCHIVE__ maker, read archive content and decompress it
ARCHIVE=$(awk '/^__ARCHIVE__/ {print NR + 1; exit 0; }' "${0}")
tail -n+${ARCHIVE} "${0}" | tar xzv -C ${DESTINATION}
# Any post-installation tasks
echo ""
echo "> Installation complete."
echo "> Don't forget to run adblock.sh in ${DESTINATION}"
echo ""
# Exit from the script with success (0)
exit 0
__ARCHIVE__
EOF
echo "> Creating installer for adblock"
cat adblock.tar.gz >> install-adblock.sh
chmod +x install-adblock.sh
echo "> Installer created."