mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Merge pull request #4663 from pi-hole/no_root
Only use sudo power if needed
This commit is contained in:
commit
42d3368955
1 changed files with 31 additions and 9 deletions
40
pihole
40
pihole
|
@ -365,7 +365,7 @@ statusFunc() {
|
||||||
# Enable blocking
|
# Enable blocking
|
||||||
"${PI_HOLE_BIN_DIR}"/pihole enable
|
"${PI_HOLE_BIN_DIR}"/pihole enable
|
||||||
fi
|
fi
|
||||||
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
tailFunc() {
|
tailFunc() {
|
||||||
|
@ -496,8 +496,38 @@ if [[ $# = 0 ]]; then
|
||||||
helpFunc
|
helpFunc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# functions that do not require sudo power
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
"-h" | "help" | "--help" ) helpFunc;;
|
"-h" | "help" | "--help" ) helpFunc;;
|
||||||
|
"-v" | "version" ) versionFunc "$@";;
|
||||||
|
"-c" | "chronometer" ) chronometerFunc "$@";;
|
||||||
|
"-q" | "query" ) queryFunc "$@";;
|
||||||
|
"status" ) statusFunc "$2";;
|
||||||
|
"-t" | "tail" ) tailFunc "$2";;
|
||||||
|
"tricorder" ) tricorderFunc;;
|
||||||
|
|
||||||
|
# we need to add all arguments that require sudo power to not trigger the * argument
|
||||||
|
"-w" | "whitelist" ) ;;
|
||||||
|
"-b" | "blacklist" ) ;;
|
||||||
|
"--wild" | "wildcard" ) ;;
|
||||||
|
"--regex" | "regex" ) ;;
|
||||||
|
"--white-regex" | "white-regex" ) ;;
|
||||||
|
"--white-wild" | "white-wild" ) ;;
|
||||||
|
"-f" | "flush" ) ;;
|
||||||
|
"-up" | "updatePihole" ) ;;
|
||||||
|
"-r" | "reconfigure" ) ;;
|
||||||
|
"-g" | "updateGravity" ) ;;
|
||||||
|
"-l" | "logging" ) ;;
|
||||||
|
"uninstall" ) ;;
|
||||||
|
"enable" ) ;;
|
||||||
|
"disable" ) ;;
|
||||||
|
"-d" | "debug" ) ;;
|
||||||
|
"restartdns" ) ;;
|
||||||
|
"-a" | "admin" ) ;;
|
||||||
|
"checkout" ) ;;
|
||||||
|
"updatechecker" ) ;;
|
||||||
|
"arpflush" ) ;;
|
||||||
|
* ) helpFunc;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Must be root to use this tool
|
# Must be root to use this tool
|
||||||
|
@ -524,21 +554,13 @@ case "${1}" in
|
||||||
"-up" | "updatePihole" ) updatePiholeFunc "$@";;
|
"-up" | "updatePihole" ) updatePiholeFunc "$@";;
|
||||||
"-r" | "reconfigure" ) reconfigurePiholeFunc;;
|
"-r" | "reconfigure" ) reconfigurePiholeFunc;;
|
||||||
"-g" | "updateGravity" ) updateGravityFunc "$@";;
|
"-g" | "updateGravity" ) updateGravityFunc "$@";;
|
||||||
"-c" | "chronometer" ) chronometerFunc "$@";;
|
|
||||||
"-h" | "help" ) helpFunc;;
|
|
||||||
"-v" | "version" ) versionFunc "$@";;
|
|
||||||
"-q" | "query" ) queryFunc "$@";;
|
|
||||||
"-l" | "logging" ) piholeLogging "$@";;
|
"-l" | "logging" ) piholeLogging "$@";;
|
||||||
"uninstall" ) uninstallFunc;;
|
"uninstall" ) uninstallFunc;;
|
||||||
"enable" ) piholeEnable 1;;
|
"enable" ) piholeEnable 1;;
|
||||||
"disable" ) piholeEnable 0 "$2";;
|
"disable" ) piholeEnable 0 "$2";;
|
||||||
"status" ) statusFunc "$2";;
|
|
||||||
"restartdns" ) restartDNS "$2";;
|
"restartdns" ) restartDNS "$2";;
|
||||||
"-a" | "admin" ) webpageFunc "$@";;
|
"-a" | "admin" ) webpageFunc "$@";;
|
||||||
"-t" | "tail" ) tailFunc "$2";;
|
|
||||||
"checkout" ) piholeCheckoutFunc "$@";;
|
"checkout" ) piholeCheckoutFunc "$@";;
|
||||||
"tricorder" ) tricorderFunc;;
|
|
||||||
"updatechecker" ) updateCheckFunc "$@";;
|
"updatechecker" ) updateCheckFunc "$@";;
|
||||||
"arpflush" ) arpFunc "$@";;
|
"arpflush" ) arpFunc "$@";;
|
||||||
* ) helpFunc;;
|
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue