From 3931048281b7bbe80d21ce84a7234db0c7931271 Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Tue, 25 Feb 2014 15:15:53 +0100 Subject: No daemon-reload in chroot (FS#37691) --- src/netctl.in | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/netctl.in b/src/netctl.in index 57b528d..6babecf 100644 --- a/src/netctl.in +++ b/src/netctl.in @@ -24,6 +24,10 @@ Commands: END } +sd_booted() { + [[ -d /run/systemd/system ]] +} + sd_escape() { local IFS='' # Prevent a recursion loop on backspaces @@ -122,7 +126,6 @@ unit_enable() { mkdir -p "@systemdsystemconfdir@/multi-user.target.wants" echo "ln -s '$unit' '${unit/system\//system/multi-user.target.wants/}'" ln -s "$unit" "${unit/system\//system/multi-user.target.wants/}" - systemctl daemon-reload } unit_disable() { @@ -135,7 +138,6 @@ unit_disable() { return 1 fi do_debug rm "$unit" - systemctl daemon-reload } @@ -165,11 +167,17 @@ case $# in switch_to "$2";; enable|disable) ensure_root "$(basename "$0")" - "unit_$1" "$2";; + "unit_$1" "$2" + if sd_booted; then + systemctl daemon-reload + fi;; reenable) ensure_root "$(basename "$0")" unit_disable "$2" - unit_enable "$2";; + unit_enable "$2" + if sd_booted; then + systemctl daemon-reload + fi;; *) exit_error "$(usage)";; esac;; -- cgit v1.2.3-24-g4f1b