Add code to remove old lighttpd config files left over from v5. (#5314)

This commit is contained in:
Adam Warner 2023-06-18 21:53:07 +01:00 committed by GitHub
commit 0fa5c62450
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 1 deletions

View file

@ -1001,6 +1001,34 @@ remove_old_dnsmasq_ftl_configs() {
fi
}
remove_old_pihole_lighttpd_configs() {
local lighttpdConfig="/etc/lighttpd/lighttpd.conf"
local condfd="/etc/lighttpd/conf.d/pihole-admin.conf"
local confavailable="/etc/lighttpd/conf-available/15-pihole-admin.conf"
local confenabled="/etc/lighttpd/conf-enabled/15-pihole-admin.conf"
if [[ -f "${lighttpdConfig}" ]]; then
sed -i '/include "\/etc\/lighttpd\/conf.d\/pihole-admin.conf"/d' "${lighttpdConfig}"
fi
if [[ -f "${condfd}" ]]; then
rm "${condfd}"
fi
if is_command lighty-disable-mod ; then
lighty-disable-mod pihole-admin > /dev/null || true
fi
if [[ -f "${confavailable}" ]]; then
rm "${confavailable}"
fi
if [[ -f "${confenabled}" ]]; then
rm "${confenabled}"
fi
}
# Clean an existing installation to prepare for upgrade/reinstall
clean_existing() {
# Local, named variables
@ -1486,6 +1514,7 @@ installPihole() {
fi
remove_old_dnsmasq_ftl_configs
remove_old_pihole_lighttpd_configs
# Install config files
if ! installConfigs; then

View file

@ -178,7 +178,7 @@ database_table_from_file() {
echo "${rowid},\"${domain}\",${timestamp}" >> "${tmpFile}"
elif [[ "${table}" == "adlist" ]]; then
# Adlist table format
echo "${rowid},\"${domain}\",1,${timestamp},${timestamp},\"Migrated from ${src}\",,0,0,0" >> "${tmpFile}"
echo "${rowid},\"${domain}\",1,${timestamp},${timestamp},\"Migrated from ${src}\",,0,0,0,0" >> "${tmpFile}"
else
# White-, black-, and regexlist table format
echo "${rowid},${list_type},\"${domain}\",1,${timestamp},${timestamp},\"Migrated from ${src}\"" >> "${tmpFile}"