aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2021-10-20 09:24:53 -0400
committerB. Stack <bgstack15@gmail.com>2021-10-20 09:33:10 -0400
commitabd012174f9545f4d4bd236716e51dedcad8c6f1 (patch)
treed0b1b735079111457f445166c11217c7822def1b
parentinitial commit (diff)
downloadsystemctl-service-shim-upstream/0.0.2.tar.gz
systemctl-service-shim-upstream/0.0.2.tar.bz2
systemctl-service-shim-upstream/0.0.2.zip
add symlink control logicHEADupstream/0.0.2devuan/0.0.2master
-rw-r--r--NEWS4
-rw-r--r--debian/changelog6
-rwxr-xr-xsystemctl15
3 files changed, 24 insertions, 1 deletions
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..d4cc743
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,4 @@
+systemctl-service-shim 0.0.2
+============================
+2021-10-20
+* Add symlink control logic to add/remove /bin/systemctl
diff --git a/debian/changelog b/debian/changelog
index 8b6af38..cb950d0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+systemctl-service-shim (0.0.2-1) unstable; urgency=low
+
+ * Add /bin/systemctl symlink control logic
+
+ -- B. Stack <bgstack15@gmail.com> Wed, 20 Oct 2021 09:27:16 -0400
+
systemctl-service-shim (0.0.1-1) unstable; urgency=low
* Initial release.
diff --git a/systemctl b/systemctl
index a4d8d54..23e799c 100755
--- a/systemctl
+++ b/systemctl
@@ -12,6 +12,7 @@
# History:
# 2020-05-14 place framework.sh contents inline so as not to depend on it.
# 2021-01-10 adapted for inclusion in devuan-sanity
+# 2021-10-20 add /bin/systemctl symlink control logic
# Usage:
# Should be mostly like systemctl from systemd.
# Reference: ftemplate.sh 2019-05-02a ; framework.sh 2018-05-02a
@@ -27,7 +28,7 @@
# in some service scripts that look for /bin/systemctl
# vim: set sw=3 sts=3 ts=3 et:
fiversion="2019-05-02a"
-systemctlversion="2021-06-11a"
+systemctlversion="2021-10-20a"
usage() {
${PAGER:-/usr/bin/less -F} >&2 <<ENDUSAGE
@@ -512,6 +513,13 @@ case "${action}" in
;;
esac
+if test "${0}" = "/bin/systemctl" && test "$( readlink -f /bin/systemctl )" = "/usr/sbin/systemctl" ;
+then
+ log_to_file "META: removing /bin/systemctl symlink"
+ unlink /bin/systemctl
+ export FIX_BIN_SYSTEMCTL=1
+fi
+
# list of actions
if test -n "${actionlist}" ;
then
@@ -524,5 +532,10 @@ then
done
fi
+if test "${FIX_BIN_SYSTEMCTL}" = "1" ;
+then
+ log_to_file "META: restoring /bin/systemctl symlink"
+ ln -s /usr/sbin/systemctl /bin/systemctl
+fi
# exit cleanly
:
bgstack15