Merge pull request #1033 from pi-hole/fix/touch_guard

Add touch guards for Buster hosts and Bullseye images.
This commit is contained in:
Adam Warner 2022-04-01 18:19:51 +01:00 committed by GitHub
commit 5d8fd599bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 5 deletions

View File

@ -20,7 +20,12 @@ prepare_configs() {
LIGHTTPD_GROUP="www-data"
LIGHTTPD_CFG="lighttpd.conf.debian"
installConfigs
touch "$setupVars"
if [ ! -f "${setupVars}" ]; then
touch "${setupVars}"
echo "Creating empty ${setupVars} file."
fi
set +e
mkdir -p /var/run/pihole /var/log/pihole

View File

@ -74,6 +74,7 @@ if [[ "${PIHOLE_DOCKER_TAG}" != "dev" && "${PIHOLE_DOCKER_TAG}" != "nightly" ]];
sed -i $'s/)\s*piholeCheckoutFunc/) unsupportedFunc/g' /usr/local/bin/pihole
fi
touch /.piholeFirstBoot
if [ ! -f /.piholeFirstBoot ]; then
touch /.piholeFirstBoot
fi
echo 'Docker install successful'

View File

@ -19,8 +19,10 @@ else
#remove fifo if exists
[[ -p /var/log/lighttpd/access.log ]] && rm -Rf /var/log/lighttpd/access.log
[[ -p /var/log/lighttpd/error.log ]] && rm -Rf /var/log/lighttpd/error.log
# Touch log files to ensure they exist (create if non-existing, preserve if existing)
touch /var/log/lighttpd/access.log /var/log/lighttpd/error.log
[[ ! -f /var/log/lighttpd/access.log ]] && touch /var/log/lighttpd/access.log
[[ ! -f /var/log/lighttpd/error.log ]] && touch /var/log/lighttpd/error.log
# Ensure that permissions are set so that lighttpd can write to the logs
chown -R www-data:www-data /var/log/lighttpd

View File

@ -7,7 +7,11 @@ rm /run/pihole/FTL.sock 2> /dev/null
# Touch files to ensure they exist (create if non-existing, preserve if existing)
mkdir -pm 0755 /run/pihole
touch /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole-FTL.log /var/log/pihole.log /etc/pihole/dhcp.leases
[[ ! -f /run/pihole-FTL.pid ]] && touch /run/pihole-FTL.pid
[[ ! -f /run/pihole-FTL.port ]] && touch /run/pihole-FTL.port
[[ ! -f /var/log/pihole-FTL.log ]] && touch /var/log/pihole-FTL.log
[[ ! -f /var/log/pihole.log ]] && touch /var/log/pihole.log
[[ ! -f /etc/pihole/dhcp.leases ]] && touch /etc/pihole/dhcp.leases
# Ensure that permissions are set so that pihole-FTL can edit all necessary files
chown pihole:pihole /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole-FTL.log /var/log/pihole.log /etc/pihole/dhcp.leases /run/pihole /etc/pihole