Skip to content

Commit fd85879

Browse files
committed
improve disableservices
1 parent 887fbb2 commit fd85879

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

malcolm-iso/config/includes.chroot/usr/local/bin/common-init.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ function CleanDefaultAccounts() {
4646
chmod 700 "/etc/cron.hourly" "/etc/cron.daily" "/etc/cron.weekly" "/etc/cron.monthly" "/etc/cron.d" >/dev/null 2>&1 || true
4747
}
4848
49+
# disable automatic running of some services
4950
# disable automatic running of some services
5051
function DisableServices() {
5152
local service
52-
local services=(
53+
local -a services=(
5354
apt-daily-upgrade.service
5455
apt-daily-upgrade.timer
5556
apt-daily.service
@@ -70,6 +71,15 @@ function DisableServices() {
7071
suricata.service
7172
)
7273
74+
local -a networkd_units=(
75+
systemd-networkd.service
76+
systemd-networkd-wait-online.service
77+
systemd-networkd.socket
78+
systemd-networkd-varlink.socket
79+
systemd-networkd-varlink-metrics.socket
80+
systemd-networkd-resolve-hook.socket
81+
)
82+
7383
for service in "${services[@]}"; do
7484
systemctl stop "$service" >/dev/null 2>&1 || true
7585
systemctl disable "$service" >/dev/null 2>&1 || true
@@ -79,6 +89,12 @@ function DisableServices() {
7989
for service in clamav-daemon clamav-freshclam; do
8090
update-rc.d -f "$service" remove >/dev/null 2>&1 || true
8191
done
92+
93+
for service in "${networkd_units[@]}"; do
94+
systemctl disable --now "$service" >/dev/null 2>&1 || true
95+
systemctl mask "$service" >/dev/null 2>&1 || true
96+
systemctl reset-failed "$service" >/dev/null 2>&1 || true
97+
done
8298
}
8399
84100
# setup initially-created user's directory based on /etc/skel

0 commit comments

Comments
 (0)