mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Add host-record option
This commit is contained in:
parent
0fe5efba76
commit
7ed1bbad49
1 changed files with 26 additions and 0 deletions
|
@ -127,6 +127,12 @@ trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE3
|
|||
" >> "${dnsmasqconfig}"
|
||||
fi
|
||||
|
||||
delete_dnsmasq_setting "host-record"
|
||||
|
||||
if [ -n "${#HOSTRECORD}" ]; then
|
||||
add_dnsmasq_setting "host-record" "${HOSTRECORD}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
SetDNSServers(){
|
||||
|
@ -313,6 +319,7 @@ ResolutionSettings() {
|
|||
elif [[ "${typ}" == "clients" ]]; then
|
||||
change_setting "API_GET_CLIENT_HOSTNAME" "${state}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
AddDHCPStaticAddress() {
|
||||
|
@ -331,6 +338,7 @@ AddDHCPStaticAddress() {
|
|||
# Full info given
|
||||
echo "dhcp-host=${mac},${ip},${host}" >> "${dhcpstaticconfig}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
RemoveDHCPStaticAddress() {
|
||||
|
@ -340,6 +348,23 @@ RemoveDHCPStaticAddress() {
|
|||
|
||||
}
|
||||
|
||||
SetHostRecord(){
|
||||
|
||||
if [ -n "${args[3]}" ]; then
|
||||
change_setting "HOSTRECORD" "${args[2]},${args[3]}"
|
||||
echo "Setting host record for ${args[2]} -> ${args[3]}"
|
||||
else
|
||||
change_setting "HOSTRECORD" ""
|
||||
echo "Removing host record"
|
||||
fi
|
||||
|
||||
ProcessDNSSettings
|
||||
|
||||
# Restart dnsmasq to load new configuration
|
||||
RestartDNS
|
||||
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
args=("$@")
|
||||
|
@ -363,6 +388,7 @@ main() {
|
|||
"resolve" ) ResolutionSettings;;
|
||||
"addstaticdhcp" ) AddDHCPStaticAddress;;
|
||||
"removestaticdhcp" ) RemoveDHCPStaticAddress;;
|
||||
"hostrecord" ) SetHostRecord;;
|
||||
* ) helpFunc;;
|
||||
esac
|
||||
|
||||
|
|
Loading…
Reference in a new issue