summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2014-02-25 15:15:53 +0100
committerJouke Witteveen <j.witteveen@gmail.com>2014-02-25 15:21:08 +0100
commit3931048281b7bbe80d21ce84a7234db0c7931271 (patch)
treeeb4b7be5431f9cbc0683e2231b34c6cc3e6cbb09
parent33c6ca7f01a36551ca436a96aafd1bf639bcea2f (diff)
downloadnetctl-3931048281b7bbe80d21ce84a7234db0c7931271.tar.gz
netctl-3931048281b7bbe80d21ce84a7234db0c7931271.tar.xz
No daemon-reload in chroot (FS#37691)
-rw-r--r--src/netctl.in16
1 files changed, 12 insertions, 4 deletions
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;;