1
0
mirror of https://github.com/pi-hole/pi-hole synced 2025-01-02 20:20:56 +00:00

Exit early when neither service nor systemctl commands are available

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2024-12-23 09:13:34 +01:00
parent a9948304db
commit a2a22c4e13
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD

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