1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 23:08:07 +00:00

Remove static leases from DHCP static leases file

This commit is contained in:
DL6ER 2017-01-25 10:35:03 +01:00
parent 4301b9a12a
commit 5c95c4074b
No known key found for this signature in database
GPG Key ID: BB8EC0BC77973A30

View File

@ -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