1
0
mirror of https://github.com/pi-hole/pi-hole synced 2025-01-03 04:30:55 +00:00

Exit early when neither service nor systemctl commands are available (#5834)

This commit is contained in:
Dominik 2024-12-26 07:19:22 +01:00 committed by GitHub
commit 3406915917
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2328,6 +2328,17 @@ migrate_dnsmasq_configs() {
mv /etc/dnsmasq.d/06-rfc6761.conf "${V6_CONF_MIGRATION_DIR}/" 2>/dev/null || true
}
# Check for availability of either the "service" or "systemctl" commands
check_service_command() {
# Check for the availability of the "service" command
if ! is_command service && ! is_command systemctl; then
# If neither the "service" nor the "systemctl" command is available, inform the user
printf " %b Neither the service nor the systemctl commands are available\\n" "${CROSS}"
printf " on this machine. This Pi-hole installer cannot continue.\\n"
exit 1
fi
}
main() {
######## FIRST CHECK ########
# Must be root to install
@ -2376,6 +2387,9 @@ main() {
# Check if SELinux is Enforcing and exit before doing anything else
checkSelinux
# Check for availability of either the "service" or "systemctl" commands
check_service_command
# Check for supported package managers so that we may install dependencies
package_manager_detect