forked from AdguardTeam/AdGuardDNS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostinstall.sh
36 lines (30 loc) · 1007 Bytes
/
postinstall.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
#!/bin/bash
set -e -x -o pipefail
echo "executing $0"
case "$1" in
configure)
if ! getent passwd "<%= user %>" > /dev/null ; then
echo "Adding user for <%= project %>" >&2
adduser --system -ingroup nogroup --quiet \
--no-create-home \
--disabled-login \
--gecos "<%= project %> user" \
--shell /bin/bash "<%= user %>"
fi
OUTFILE="/var/lib/dnsfilter/dns.txt"
if [ ! -f "${OUTFILE}" ]; then
echo "${OUTFILE} does not exists. Downloading..."
URL="https://filters.adtidy.org/android/filters/15.txt"
mkdir -p /var/lib/dnsfilter
wget -q --timeout=90 "$URL" -O "$OUTFILE"
if [ $? -ne 0 ]
then
echo "Filter rules could not be downloaded."
fi
fi
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac