mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Add option to not reload
Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
parent
b7bba6a689
commit
bc21a7155d
1 changed files with 20 additions and 8 deletions
|
@ -709,6 +709,7 @@ AddCustomDNSAddress() {
|
||||||
|
|
||||||
ip="${args[2]}"
|
ip="${args[2]}"
|
||||||
host="${args[3]}"
|
host="${args[3]}"
|
||||||
|
reload="${args[4]}"
|
||||||
|
|
||||||
if valid_ip "${ip}" || valid_ip6 "${ip}" ; then
|
if valid_ip "${ip}" || valid_ip6 "${ip}" ; then
|
||||||
echo "${ip} ${host}" >> "${dnscustomfile}"
|
echo "${ip} ${host}" >> "${dnscustomfile}"
|
||||||
|
@ -717,8 +718,10 @@ AddCustomDNSAddress() {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Restart dnsmasq to load new custom DNS entries
|
# Restart dnsmasq to load new custom DNS entries only if $reload not false
|
||||||
RestartDNS
|
if [[ ! $reload == "false" ]]; then
|
||||||
|
RestartDNS
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveCustomDNSAddress() {
|
RemoveCustomDNSAddress() {
|
||||||
|
@ -726,11 +729,14 @@ RemoveCustomDNSAddress() {
|
||||||
|
|
||||||
ip="${args[2]}"
|
ip="${args[2]}"
|
||||||
host="${args[3]}"
|
host="${args[3]}"
|
||||||
|
reload="${args[4]}"
|
||||||
|
|
||||||
sed -i "/^${ip} ${host}$/d" "${dnscustomfile}"
|
sed -i "/^${ip} ${host}$/d" "${dnscustomfile}"
|
||||||
|
|
||||||
# Restart dnsmasq to update removed custom DNS entries
|
# Restart dnsmasq to load new custom DNS entries only if reload is not false
|
||||||
RestartDNS
|
if [[ ! $reload == "false" ]]; then
|
||||||
|
RestartDNS
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
AddCustomCNAMERecord() {
|
AddCustomCNAMERecord() {
|
||||||
|
@ -738,6 +744,7 @@ AddCustomCNAMERecord() {
|
||||||
|
|
||||||
domain="${args[2]}"
|
domain="${args[2]}"
|
||||||
target="${args[3]}"
|
target="${args[3]}"
|
||||||
|
reload="${args[4]}"
|
||||||
|
|
||||||
validDomain="$(checkDomain "${domain}")"
|
validDomain="$(checkDomain "${domain}")"
|
||||||
if [[ -n "${validDomain}" ]]; then
|
if [[ -n "${validDomain}" ]]; then
|
||||||
|
@ -752,8 +759,10 @@ AddCustomCNAMERecord() {
|
||||||
echo " ${CROSS} Invalid Domain passed!"
|
echo " ${CROSS} Invalid Domain passed!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# Restart dnsmasq to load new custom CNAME records
|
# Restart dnsmasq to load new custom CNAME records only if reload is not false
|
||||||
RestartDNS
|
if [[ ! $reload == "false" ]]; then
|
||||||
|
RestartDNS
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveCustomCNAMERecord() {
|
RemoveCustomCNAMERecord() {
|
||||||
|
@ -761,11 +770,14 @@ RemoveCustomCNAMERecord() {
|
||||||
|
|
||||||
domain="${args[2]}"
|
domain="${args[2]}"
|
||||||
target="${args[3]}"
|
target="${args[3]}"
|
||||||
|
reload="${args[4]}"
|
||||||
|
|
||||||
sed -i "/cname=${domain},${target}$/d" "${dnscustomcnamefile}"
|
sed -i "/cname=${domain},${target}$/d" "${dnscustomcnamefile}"
|
||||||
|
|
||||||
# Restart dnsmasq to update removed custom CNAME records
|
# Restart dnsmasq to update removed custom CNAME records only if $reload not false
|
||||||
RestartDNS
|
if [[ ! $reload == "false" ]]; then
|
||||||
|
RestartDNS
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
|
Loading…
Reference in a new issue