-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcreateinstaller.sh
44 lines (33 loc) · 1.17 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 adbhostgen.tar.gz
rm installer.sh
tar czvf adbhostgen.tar.gz README adbhostgen.sh blacklist cacert.pem mpdomains mphosts whitelist
echo "> Generating installer stub"
cat << 'EOF' > installer.sh
#!/bin/sh
echo "======================================================"
echo "| Installing adblock for DD-WRT |"
echo "| https://github.com/m-parashar/adbhostgen |"
echo "| Copyright 2018 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 adbhostgen.sh in ${DESTINATION}"
echo ""
# Exit from the script with success (0)
exit 0
__ARCHIVE__
EOF
echo "> Creating installer for adbhostgen"
cat adbhostgen.tar.gz >> installer.sh
chmod +x installer.sh
echo "> Installer created."