mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Make webpage.sh fully library style
This commit is contained in:
parent
9af26cbaac
commit
1e627c7e8f
2 changed files with 31 additions and 27 deletions
|
@ -9,8 +9,6 @@
|
||||||
# the Free Software Foundation, either version 2 of the License, or
|
# the Free Software Foundation, either version 2 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
|
||||||
args=("$@")
|
|
||||||
|
|
||||||
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"
|
||||||
|
@ -275,30 +273,35 @@ ResolutionSettings() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
case "${args[1]}" in
|
main() {
|
||||||
"-p" | "password" ) SetWebPassword;;
|
|
||||||
"-c" | "celsius" ) unit="C"; SetTemperatureUnit;;
|
|
||||||
"-f" | "fahrenheit" ) unit="F"; SetTemperatureUnit;;
|
|
||||||
"-k" | "kelvin" ) unit="K"; SetTemperatureUnit;;
|
|
||||||
"setdns" ) SetDNSServers;;
|
|
||||||
"setexcludedomains" ) SetExcludeDomains;;
|
|
||||||
"setexcludeclients" ) SetExcludeClients;;
|
|
||||||
"reboot" ) Reboot;;
|
|
||||||
"restartdns" ) RestartDNS;;
|
|
||||||
"setquerylog" ) SetQueryLogOptions;;
|
|
||||||
"enabledhcp" ) EnableDHCP;;
|
|
||||||
"disabledhcp" ) DisableDHCP;;
|
|
||||||
"layout" ) SetWebUILayout;;
|
|
||||||
"-h" | "--help" ) helpFunc;;
|
|
||||||
"domainname" ) SetDHCPDomainName;;
|
|
||||||
"privacymode" ) SetPrivacyMode;;
|
|
||||||
"resolve" ) ResolutionSettings;;
|
|
||||||
* ) helpFunc;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
shift
|
args=("$@")
|
||||||
|
|
||||||
if [[ $# = 0 ]]; then
|
case "${args[1]}" in
|
||||||
helpFunc
|
"-p" | "password" ) SetWebPassword;;
|
||||||
fi
|
"-c" | "celsius" ) unit="C"; SetTemperatureUnit;;
|
||||||
|
"-f" | "fahrenheit" ) unit="F"; SetTemperatureUnit;;
|
||||||
|
"-k" | "kelvin" ) unit="K"; SetTemperatureUnit;;
|
||||||
|
"setdns" ) SetDNSServers;;
|
||||||
|
"setexcludedomains" ) SetExcludeDomains;;
|
||||||
|
"setexcludeclients" ) SetExcludeClients;;
|
||||||
|
"reboot" ) Reboot;;
|
||||||
|
"restartdns" ) RestartDNS;;
|
||||||
|
"setquerylog" ) SetQueryLogOptions;;
|
||||||
|
"enabledhcp" ) EnableDHCP;;
|
||||||
|
"disabledhcp" ) DisableDHCP;;
|
||||||
|
"layout" ) SetWebUILayout;;
|
||||||
|
"-h" | "--help" ) helpFunc;;
|
||||||
|
"domainname" ) SetDHCPDomainName;;
|
||||||
|
"privacymode" ) SetPrivacyMode;;
|
||||||
|
"resolve" ) ResolutionSettings;;
|
||||||
|
* ) helpFunc;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
shift
|
||||||
|
|
||||||
|
if [[ $# = 0 ]]; then
|
||||||
|
helpFunc
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
3
pihole
3
pihole
|
@ -23,7 +23,8 @@ if [[ ! $EUID -eq 0 ]];then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
webpageFunc() {
|
webpageFunc() {
|
||||||
/opt/pihole/webpage.sh "$@"
|
source /opt/pihole/webpage.sh
|
||||||
|
main "$@"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue