mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-19 05:40:13 +00:00
Adjust addOrEditKeyValPair to optionally take two or three arguments (adjust test to suit)
Add a removeKey function with test update webpage.sh to reference functions in utils.sh (this can likely be abstracted/refactored further) Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
parent
ff5e788889
commit
48138d32b6
3 changed files with 73 additions and 23 deletions
|
@ -26,6 +26,9 @@ readonly PI_HOLE_FILES_DIR="/etc/.pihole"
|
|||
PH_TEST="true"
|
||||
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
|
||||
|
||||
readonly utilsfile="/opt/pihole/utils.sh"
|
||||
source "${utilsfile}"
|
||||
|
||||
coltable="/opt/pihole/COL_TABLE"
|
||||
if [[ -f ${coltable} ]]; then
|
||||
source ${coltable}
|
||||
|
@ -51,41 +54,35 @@ Options:
|
|||
}
|
||||
|
||||
add_setting() {
|
||||
echo "${1}=${2}" >> "${setupVars}"
|
||||
addOrEditKeyValPair "${1}" "${2}" "${setupVars}"
|
||||
}
|
||||
|
||||
delete_setting() {
|
||||
sed -i "/^${1}/d" "${setupVars}"
|
||||
removeKey "${1}" "${setupVars}"
|
||||
}
|
||||
|
||||
change_setting() {
|
||||
delete_setting "${1}"
|
||||
add_setting "${1}" "${2}"
|
||||
addOrEditKeyValPair "${1}" "${2}" "${setupVars}"
|
||||
}
|
||||
|
||||
addFTLsetting() {
|
||||
echo "${1}=${2}" >> "${FTLconf}"
|
||||
addOrEditKeyValPair "${1}" "${2}" "${FTLconf}"
|
||||
}
|
||||
|
||||
deleteFTLsetting() {
|
||||
sed -i "/^${1}/d" "${FTLconf}"
|
||||
removeKey "${1}" "${FTLconf}"
|
||||
}
|
||||
|
||||
changeFTLsetting() {
|
||||
deleteFTLsetting "${1}"
|
||||
addFTLsetting "${1}" "${2}"
|
||||
addOrEditKeyValPair "${1}" "${2}" "${FTLconf}"
|
||||
}
|
||||
|
||||
add_dnsmasq_setting() {
|
||||
if [[ "${2}" != "" ]]; then
|
||||
echo "${1}=${2}" >> "${dnsmasqconfig}"
|
||||
else
|
||||
echo "${1}" >> "${dnsmasqconfig}"
|
||||
fi
|
||||
addOrEditKeyValPair "${1}" "${2}" "${dnsmasqconfig}"
|
||||
}
|
||||
|
||||
delete_dnsmasq_setting() {
|
||||
sed -i "/^${1}/d" "${dnsmasqconfig}"
|
||||
removeKey "${1}" "${dnsmasqconfig}"
|
||||
}
|
||||
|
||||
SetTemperatureUnit() {
|
||||
|
@ -183,7 +180,7 @@ ProcessDNSSettings() {
|
|||
fi
|
||||
|
||||
delete_dnsmasq_setting "dnssec"
|
||||
delete_dnsmasq_setting "trust-anchor="
|
||||
delete_dnsmasq_setting "trust-anchor"
|
||||
|
||||
if [[ "${DNSSEC}" == true ]]; then
|
||||
echo "dnssec
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue