mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 14:58:08 +00:00
Remove static leases from DHCP static leases file
This commit is contained in:
parent
4301b9a12a
commit
5c95c4074b
@ -323,16 +323,23 @@ AddDHCPStaticAddress() {
|
||||
|
||||
if [[ "${ip}" == "noip" ]]; then
|
||||
# Static host name
|
||||
echo "dhcp-host=${mac},${host}" >> "dhcpstaticconfig"
|
||||
echo "dhcp-host=${mac},${host}" >> "${dhcpstaticconfig}"
|
||||
elif [[ "${host}" == "nohost" ]]; then
|
||||
# Static IP
|
||||
echo "dhcp-host=${mac},${ip}" >> "dhcpstaticconfig"
|
||||
echo "dhcp-host=${mac},${ip}" >> "${dhcpstaticconfig}"
|
||||
else
|
||||
# Full info given
|
||||
echo "dhcp-host=${mac},${ip},${host}" >> "dhcpstaticconfig"
|
||||
echo "dhcp-host=${mac},${ip},${host}" >> "${dhcpstaticconfig}"
|
||||
fi
|
||||
}
|
||||
|
||||
RemoveDHCPStaticAddress() {
|
||||
|
||||
mac="${args[2]}"
|
||||
sed -i "/dhcp-host=${mac}.*/d" "${dhcpstaticconfig}"
|
||||
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
args=("$@")
|
||||
@ -355,6 +362,7 @@ main() {
|
||||
"privacymode" ) SetPrivacyMode;;
|
||||
"resolve" ) ResolutionSettings;;
|
||||
"addstatic" ) AddDHCPStaticAddress;;
|
||||
"removestatic" ) RemoveDHCPStaticAddress;;
|
||||
* ) helpFunc;;
|
||||
esac
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user