use sed substitute instead of delete and append

doesn't move the line to the end of the file, instead keeps the order of the lines in setupVars.conf intact

Signed-off-by: Lukas Schlötterer <80917404+lschloetterer@users.noreply.github.com>
This commit is contained in:
Lukas Schlötterer 2022-01-11 21:40:26 +01:00 committed by GitHub
parent 3260cb40b5
commit c02967172e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

6
pihole
View file

@ -223,8 +223,7 @@ Time:
fi
local str="Pi-hole Disabled"
sed -i "/BLOCKING_ENABLED=/d" "${setupVars}"
echo "BLOCKING_ENABLED=false" >> "${setupVars}"
sed -i "s/BLOCKING_ENABLED=true/BLOCKING_ENABLED=false/" "${setupVars}"
fi
else
# Enable Pi-hole
@ -236,8 +235,7 @@ Time:
echo -e " ${INFO} Enabling blocking"
local str="Pi-hole Enabled"
sed -i "/BLOCKING_ENABLED=/d" "${setupVars}"
echo "BLOCKING_ENABLED=true" >> "${setupVars}"
sed -i "s/BLOCKING_ENABLED=false/BLOCKING_ENABLED=true/" "${setupVars}"
fi
restartDNS reload-lists