From b9ded9172484b1b428167eed2df3b2e613cf5642 Mon Sep 17 00:00:00 2001 From: Damien Cavagnini Date: Fri, 11 Jul 2025 14:20:27 +0200 Subject: [PATCH] update lib/utils.sh - add 'is_pkg_a_dependency', to ensure a package is not needed by some others before removing it -> will be used in debian 12 CIS by at least the 2.1.5 recommendation - update 'is_service_enabled' to use 'systemd' instead of 'rc.d', as we are now only supporting debian LTS using systemd - add 'is_using_sbin_init' to ensure we can use systemctl, in case of running on non detected container - add 'manage_service' to enable / disable service using systemctl chore: update script related to systemctl / service - configure_systemd-timesync.sh: use "is_service_enabled" instead of calling systemctl - disable_automounting.sh: use "manage_service" instead of "update-rc.d" - enable_auditd.sh: use "manage_service" instead of "update-rc.d" - enable_cron.sh: use "manage_service" instead of "update-rc.d" - enable_syslog-ng.sh: use "manage_service" instead of "update-rc.d" --- lib/utils.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/utils.sh b/lib/utils.sh index 4ebdd1c..9e61bfd 100644 --- a/lib/utils.sh +++ b/lib/utils.sh @@ -593,8 +593,6 @@ is_pkg_installed() { is_pkg_a_dependency() { # check if package is needed by another installed package local PKG_NAME=$1 - # ex: 'dnsmasq' is going to install 'dnsmasq-base' - # so we don't care about 'dnsmasq-base', we want to know about others packages shift local known_deps="$*" @@ -672,5 +670,4 @@ manage_service() { fi systemctl "$action" "$service" >/dev/null 2>&1 - }