From 19a3eccdec20499e58bc3ea92c1172c5d5b1d882 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 5 May 2019 02:40:28 +0530 Subject: [PATCH] Fix update script Signed-off-by: Harsh Shandilya --- update.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/update.sh b/update.sh index fe70696..c89ff50 100755 --- a/update.sh +++ b/update.sh @@ -19,7 +19,7 @@ done < <(find . -name '*.service' -print0 | sed 's/\.\///g') # Place the systemd unit files where they belong reportWarning "Copying systemd files to /etc/systemd/system" -for service in "${services[@]}"; do cp "${service}" /etc/systemd/system/; done +for service in "${services[@]}"; do sudo cp "${service}" /etc/systemd/system/; done # Reload systemctl so that it processes our changes reportWarning "Reloading systemctl daemon" @@ -27,7 +27,8 @@ sudo systemctl daemon-reload # Now loop through each service and restart it for service in "${services[@]}"; do + service="${service/.service/}" reportWarning "Restarting ${service}" - service "${service}" restart - [ -f "/etc/systemd/system/${service}.service" ] || systemctl enable "${service}" -done \ No newline at end of file + sudo service "${service}" restart + [ -f "/etc/systemd/system/multi-user.target.wants/${service}.service" ] && sudo systemctl enable "${service}" +done