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
1 changed files with 11 additions and 3 deletions

View File

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