Avoid a "No such file or directory" error

Check the file /etc/pihole/pihole-FTL.conf exists before trying to use
it.
without the patch I get, each day, in my logs:
sed: can't read /etc/pihole/pihole-FTL.conf: No such file or directory

I use a variable FTLconf to not repeat the file name twice.

Signed-off-by: Ludovic Rousseau <ludovic.rousseau@free.fr>
pull/2107/head
Ludovic Rousseau 6 years ago
parent 3b229489c2
commit d8f85a8981

@ -16,7 +16,8 @@ source ${colfile}
# Constructed to return nothing when
# a) the setting is not present in the config file, or
# b) the setting is commented out (e.g. "#DBFILE=...")
DBFILE="$(sed -n -e 's/^\s*DBFILE\s*=\s*//p' /etc/pihole/pihole-FTL.conf)"
FTLconf="/etc/pihole/pihole-FTL.conf"
[ -e "$FTLconf" ] && DBFILE="$(sed -n -e 's/^\s*DBFILE\s*=\s*//p' $FTLconf)"
# Test for empty string. Use standard path in this case.
if [ -z "$DBFILE" ]; then
DBFILE="/etc/pihole/pihole-FTL.db"

Loading…
Cancel
Save