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

Disable a few commands if installed in (official) docker containers (#5018)

This commit is contained in:
Adam Warner 2022-12-11 15:11:50 +00:00
commit 1ee922d16c
No known key found for this signature in database
GPG Key ID: 872950F3ECF2B173

34
pihole
View File

@ -23,6 +23,9 @@ source "${colfile}"
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh" utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
source "${utilsfile}" source "${utilsfile}"
versionsfile="/etc/pihole/versions"
source "${versionsfile}"
webpageFunc() { webpageFunc() {
source "${PI_HOLE_SCRIPT_DIR}/webpage.sh" source "${PI_HOLE_SCRIPT_DIR}/webpage.sh"
main "$@" main "$@"
@ -63,14 +66,22 @@ arpFunc() {
} }
updatePiholeFunc() { updatePiholeFunc() {
shift if [ -n "${DOCKER_VERSION}" ]; then
"${PI_HOLE_SCRIPT_DIR}"/update.sh "$@" unsupportedFunc
exit 0 else
shift
"${PI_HOLE_SCRIPT_DIR}"/update.sh "$@"
exit 0
fi
} }
reconfigurePiholeFunc() { reconfigurePiholeFunc() {
/etc/.pihole/automated\ install/basic-install.sh --reconfigure if [ -n "${DOCKER_VERSION}" ]; then
exit 0; unsupportedFunc
else
/etc/.pihole/automated\ install/basic-install.sh --reconfigure
exit 0;
fi
} }
updateGravityFunc() { updateGravityFunc() {
@ -91,8 +102,12 @@ chronometerFunc() {
uninstallFunc() { uninstallFunc() {
"${PI_HOLE_SCRIPT_DIR}"/uninstall.sh if [ -n "${DOCKER_VERSION}" ]; then
exit 0 unsupportedFunc
else
"${PI_HOLE_SCRIPT_DIR}"/uninstall.sh
exit 0
fi
} }
versionFunc() { versionFunc() {
@ -429,6 +444,11 @@ updateCheckFunc() {
exit 0 exit 0
} }
unsupportedFunc(){
echo "Function not supported in Docker images"
exit 0
}
helpFunc() { helpFunc() {
echo "Usage: pihole [options] echo "Usage: pihole [options]
Example: 'pihole -w -h' Example: 'pihole -w -h'