-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy pathdocker.sh
More file actions
39 lines (35 loc) · 1.31 KB
/
docker.sh
File metadata and controls
39 lines (35 loc) · 1.31 KB
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
#!/bin/bash
# Respect PH_VERBOSE environment variable
if [ "${PH_VERBOSE:-0}" -gt 0 ]; then
set -x
SCRIPT_ARGS="--verbose --debug"
fi
case $1 in
"config")
# Recreate the config file if it doesn't exist
if [ ! -f "/etc/pihole-updatelists/pihole-updatelists.conf" ]; then
cp /etc/pihole-updatelists.conf /etc/pihole-updatelists/pihole-updatelists.conf
echo " [i] Created /etc/pihole-updatelists/pihole-updatelists.conf"
fi
chown pihole:pihole /etc/pihole-updatelists/*
chmod 644 /etc/pihole-updatelists/*
;;
"cron")
# Check if the user provided a custom crontab string
if [ -n "$CRONTAB_STRING" ]; then
echo " [i] Changing pihole-updatelists schedule to: $CRONTAB_STRING"
else # Otherwise, use the default one
CRONTAB_STRING="$(sed -n '/pihole updateGravity/s/#\(.*\) PATH=.*/\1/p' /crontab.txt)"
fi
sed "/pihole-updatelists/ s|^.*PATH=|$CRONTAB_STRING PATH=|" -i /crontab.txt
;;
"run")
shift # Skip 'run' argument
# shellcheck disable=SC2086,SC2068
/usr/bin/php /usr/local/sbin/pihole-updatelists --config=/etc/pihole-updatelists/pihole-updatelists.conf --env $SCRIPT_ARGS $@
;;
*)
echo "Usage: $0 run [ARGS]"
exit 1
;;
esac