Touch dhcp.leases to ensure it exists. There are some systems out there where the installer didn't finish on the first run and some users don't have this file being created. Although /etc/pihole should be owned by pihole:pihole, pihole-FTL sometimes fails to open this file and - if this is the case and DHCP is enabled - refuses to start altogether.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2018-08-19 13:53:34 +02:00
parent 74008d28a7
commit d30b565d98
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD
1 changed files with 7 additions and 4 deletions

View File

@ -26,13 +26,16 @@ start() {
if is_running; then
echo "pihole-FTL is already running"
else
touch /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
touch /var/log/pihole-FTL.log /var/log/pihole.log
touch /run/pihole-FTL.pid /run/pihole-FTL.port
touch /etc/pihole/dhcp.leases
mkdir -p /var/run/pihole
mkdir -p /var/log/pihole
chown pihole:pihole /var/run/pihole /var/log/pihole
rm /var/run/pihole/FTL.sock 2> /dev/null
chown pihole:pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port
chown pihole:pihole /etc/pihole /etc/pihole/dhcp.leases /var/log/pihole.log
chown pihole:pihole /run/pihole-FTL.pid /run/pihole-FTL.port
chown pihole:pihole /etc/pihole /etc/pihole/dhcp.leases
chown pihole:pihole /var/log/pihole-FTL.log /var/log/pihole.log
chmod 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
setcap CAP_NET_BIND_SERVICE,CAP_NET_RAW,CAP_NET_ADMIN+eip "$(which pihole-FTL)"
echo "nameserver 127.0.0.1" | /sbin/resolvconf -a lo.piholeFTL
@ -78,7 +81,7 @@ status() {
echo "[ ] pihole-FTL is not running"
exit 1
fi
}
}
### main logic ###