mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-23 07:18:07 +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
|
if [[ "${ip}" == "noip" ]]; then
|
||||||
# Static host name
|
# Static host name
|
||||||
echo "dhcp-host=${mac},${host}" >> "dhcpstaticconfig"
|
echo "dhcp-host=${mac},${host}" >> "${dhcpstaticconfig}"
|
||||||
elif [[ "${host}" == "nohost" ]]; then
|
elif [[ "${host}" == "nohost" ]]; then
|
||||||
# Static IP
|
# Static IP
|
||||||
echo "dhcp-host=${mac},${ip}" >> "dhcpstaticconfig"
|
echo "dhcp-host=${mac},${ip}" >> "${dhcpstaticconfig}"
|
||||||
else
|
else
|
||||||
# Full info given
|
# Full info given
|
||||||
echo "dhcp-host=${mac},${ip},${host}" >> "dhcpstaticconfig"
|
echo "dhcp-host=${mac},${ip},${host}" >> "${dhcpstaticconfig}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RemoveDHCPStaticAddress() {
|
||||||
|
|
||||||
|
mac="${args[2]}"
|
||||||
|
sed -i "/dhcp-host=${mac}.*/d" "${dhcpstaticconfig}"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
|
||||||
args=("$@")
|
args=("$@")
|
||||||
@ -355,6 +362,7 @@ main() {
|
|||||||
"privacymode" ) SetPrivacyMode;;
|
"privacymode" ) SetPrivacyMode;;
|
||||||
"resolve" ) ResolutionSettings;;
|
"resolve" ) ResolutionSettings;;
|
||||||
"addstatic" ) AddDHCPStaticAddress;;
|
"addstatic" ) AddDHCPStaticAddress;;
|
||||||
|
"removestatic" ) RemoveDHCPStaticAddress;;
|
||||||
* ) helpFunc;;
|
* ) helpFunc;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user