2017-05-05 05:37:26 +02:00
#!/usr/bin/with-contenv bash
2018-07-02 13:45:39 +02:00
set -e
2017-05-05 05:37:26 +02:00
2018-01-04 04:37:19 +01:00
bashCmd = 'bash -e'
2021-02-17 00:09:49 +01:00
if [ " ${ PH_VERBOSE :- 0 } " -gt 0 ] ; then
2017-12-11 17:28:05 +01:00
set -x ;
2018-01-04 05:34:31 +01:00
bashCmd = 'bash -e -x'
2017-12-11 17:28:05 +01:00
fi
2017-05-05 05:37:26 +02:00
2018-01-27 01:26:46 +01:00
$bashCmd /start.sh
2018-12-11 04:28:53 +01:00
# Gotta go fast, no time for gravity
2021-02-17 00:09:49 +01:00
if [ -n " $PYTEST " ] ; then
sed -i 's/^gravity_spinup$/#gravity_spinup # DISABLED FOR PYTEST/g' " $( which gravity.sh) "
2018-12-11 04:28:53 +01:00
fi
2021-07-23 06:57:27 +02:00
gravityDBfile = "/etc/pihole/gravity.db"
config_file = "/etc/pihole/pihole-FTL.conf"
# make a point to mention which config file we're checking, as breadcrumb to revisit if/when pihole-FTL.conf is succeeded by TOML
echo " Checking if custom gravity.db is set in ${ config_file } "
if [ [ -f " ${ config_file } " ] ] ; then
gravityDBfile = " $( grep --color= never -Po "^GRAVITYDB=\K.*" " ${ config_file } " 2> /dev/null || echo "/etc/pihole/gravity.db" ) "
fi
if [ -z " $SKIPGRAVITYONBOOT " ] || [ ! -e " ${ gravityDBfile } " ] ; then
2021-07-21 20:41:35 +02:00
if [ -n " $SKIPGRAVITYONBOOT " ] ; then
2021-07-23 06:57:27 +02:00
echo " SKIPGRAVITYONBOOT is set, however ${ gravityDBfile } does not exist (Likely due to a fresh volume). This is a required file for Pi-hole to operate. "
2021-07-21 20:41:35 +02:00
echo " Ignoring SKIPGRAVITYONBOOT on this occaision."
fi
2021-04-16 16:37:05 +02:00
echo '@reboot root PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updateGravity >/var/log/pihole_updateGravity.log || cat /var/log/pihole_updateGravity.log' > /etc/cron.d/gravity-on-boot
2020-08-15 02:17:24 +02:00
else
echo " Skipping Gravity Database Update."
2021-04-16 18:36:09 +02:00
[ ! -e /etc/cron.d/gravity-on-boot ] || rm /etc/cron.d/gravity-on-boot & >/dev/null
2020-08-15 01:22:49 +02:00
fi
2018-01-27 01:26:46 +01:00
2020-02-04 06:39:03 +01:00
pihole -v
2021-08-05 01:59:34 +02:00
2021-09-13 00:43:59 +02:00
echo " Container tag is: ${ PIHOLE_VERSION } "