aboutsummaryrefslogtreecommitdiff
path: root/systemctl
diff options
context:
space:
mode:
Diffstat (limited to 'systemctl')
-rwxr-xr-xsystemctl11
1 files changed, 10 insertions, 1 deletions
diff --git a/systemctl b/systemctl
index 78110a9..93bdcd6 100755
--- a/systemctl
+++ b/systemctl
@@ -15,6 +15,7 @@
# 2021-10-20 add /bin/systemctl symlink control logic
# 2022-07-12 Convert try-restart to restart
# 2022-07-14 Add preset, which runs update-rc.d ${service} defaults
+# 2023-02-11 Add /usr/bin/systemctl symlink control
# Usage:
# Should be mostly like systemctl from systemd.
# Reference: ftemplate.sh 2019-05-02a ; framework.sh 2018-05-02a
@@ -29,7 +30,7 @@
# in some service scripts that look for /bin/systemctl
# vim: set sw=3 sts=3 ts=3 et:
fiversion="2019-05-02a"
-systemctlversion="2022-07-14a"
+systemctlversion="2023-02-11a"
usage() {
${PAGER:-/usr/bin/less -F} >&2 <<ENDUSAGE
@@ -533,6 +534,13 @@ then
export FIX_BIN_SYSTEMCTL=1
fi
+if test "${0}" = "/usr/bin/systemctl" && test "$( readlink -f /usr/bin/systemctl )" = "/usr/sbin/systemctl" ;
+then
+ log_to_file "META: removing /usr/bin/systemctl symlink"
+ unlink /usr/bin/systemctl
+ export FIX_BIN_SYSTEMCTL=1
+fi
+
# list of actions
if test -n "${actionlist}" ;
then
@@ -549,6 +557,7 @@ if test "${FIX_BIN_SYSTEMCTL}" = "1" ;
then
log_to_file "META: restoring /bin/systemctl symlink"
ln -s /usr/sbin/systemctl /bin/systemctl
+ ln -s /usr/sbin/systemctl /usr/bin/systemctl 2>/dev/null # might fail if /usr/bin is symlink to /bin
fi
# exit cleanly
:
bgstack15