only chown/chmod pihole-FTL.db if it exists

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner 2022-01-05 21:47:25 +00:00
parent 6b29503dd0
commit 2567ab9940
No known key found for this signature in database
GPG Key ID: 872950F3ECF2B173
1 changed files with 5 additions and 1 deletions

View File

@ -26,8 +26,12 @@ prepare_configs() {
# Re-apply perms from basic-install over any volume mounts that may be present (or not)
# Also similar to preflights for FTL https://github.com/pi-hole/pi-hole/blob/master/advanced/Templates/pihole-FTL.service
chown pihole:root /etc/lighttpd
chown pihole:pihole "${PI_HOLE_CONFIG_DIR}/pihole-FTL.conf" "${PI_HOLE_CONFIG_DIR}/pihole-FTL.db" "/var/log/pihole"
chown pihole:pihole "${PI_HOLE_CONFIG_DIR}/pihole-FTL.conf" "/var/log/pihole"
chmod 644 "${PI_HOLE_CONFIG_DIR}/pihole-FTL.conf" "${PI_HOLE_CONFIG_DIR}/pihole-FTL.db"
if [[ -e "${PI_HOLE_CONFIG_DIR}/pihole-FTL.db" ]]; then
chown pihole:pihole "${PI_HOLE_CONFIG_DIR}/pihole-FTL.db"
chmod 644 "${PI_HOLE_CONFIG_DIR}/pihole-FTL.db"
fi
touch /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
chown pihole:pihole /var/run/pihole /var/log/pihole
test -f /var/run/pihole/FTL.sock && rm /var/run/pihole/FTL.sock