mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-25 14:20:18 +00:00
Add static DHCP leases to new file
This commit is contained in:
parent
3f462c771f
commit
4301b9a12a
1 changed files with 21 additions and 0 deletions
|
@ -12,6 +12,8 @@
|
||||||
readonly setupVars="/etc/pihole/setupVars.conf"
|
readonly setupVars="/etc/pihole/setupVars.conf"
|
||||||
readonly dnsmasqconfig="/etc/dnsmasq.d/01-pihole.conf"
|
readonly dnsmasqconfig="/etc/dnsmasq.d/01-pihole.conf"
|
||||||
readonly dhcpconfig="/etc/dnsmasq.d/02-pihole-dhcp.conf"
|
readonly dhcpconfig="/etc/dnsmasq.d/02-pihole-dhcp.conf"
|
||||||
|
# 03 -> wildcards
|
||||||
|
readonly dhcpstaticconfig="/etc/dnsmasq.d/04-pihole-static-dhcp.conf"
|
||||||
|
|
||||||
helpFunc() {
|
helpFunc() {
|
||||||
cat << EOM
|
cat << EOM
|
||||||
|
@ -313,6 +315,24 @@ ResolutionSettings() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddDHCPStaticAddress() {
|
||||||
|
|
||||||
|
mac="${args[2]}"
|
||||||
|
ip="${args[3]}"
|
||||||
|
host="${args[4]}"
|
||||||
|
|
||||||
|
if [[ "${ip}" == "noip" ]]; then
|
||||||
|
# Static host name
|
||||||
|
echo "dhcp-host=${mac},${host}" >> "dhcpstaticconfig"
|
||||||
|
elif [[ "${host}" == "nohost" ]]; then
|
||||||
|
# Static IP
|
||||||
|
echo "dhcp-host=${mac},${ip}" >> "dhcpstaticconfig"
|
||||||
|
else
|
||||||
|
# Full info given
|
||||||
|
echo "dhcp-host=${mac},${ip},${host}" >> "dhcpstaticconfig"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
|
||||||
args=("$@")
|
args=("$@")
|
||||||
|
@ -334,6 +354,7 @@ main() {
|
||||||
"-h" | "--help" ) helpFunc;;
|
"-h" | "--help" ) helpFunc;;
|
||||||
"privacymode" ) SetPrivacyMode;;
|
"privacymode" ) SetPrivacyMode;;
|
||||||
"resolve" ) ResolutionSettings;;
|
"resolve" ) ResolutionSettings;;
|
||||||
|
"addstatic" ) AddDHCPStaticAddress;;
|
||||||
* ) helpFunc;;
|
* ) helpFunc;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue