[Pkg-sysvinit-devel] Bug#826214: SysV init scripts using init-d-script are not properly redirected to systemctl
Mert Dirik
mertdirik at gmail.com
Tue Jan 9 22:55:11 UTC 2018
Package: sysvinit-utils
Version: 2.88dsf-59.9
Followup-For: Bug #826214
Please forgive my naivety, but simply moving the argument shift part before
sourcing /lib/lsb/init-functions seems to successfully redirect to systemctl.
The only variable leaking to /lib/lsb/init-functions is "script", which can be
easily renamed and namespaced in case of a possible problem.
After patching /lib/init/init-d-script, both /etc/init.d/<...> start and
"service <...> start" shows up correctly in "systemctl status <...>" output.
--- /lib/init/init-d-script.orig 2018-01-09 21:25:41.763183856 +0000
+++ /lib/init/init-d-script 2018-01-09 22:38:48.463185948 +0000
@@ -5,6 +5,8 @@
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
+script="$1"
+shift
. /lib/lsb/init-functions
# PATH should only include /usr/* if it runs after the mountnfs.sh
@@ -154,11 +156,9 @@
set -x
fi
-SCRIPTNAME=$1
-scriptbasename="$(basename $1)"
+SCRIPTNAME="$script"
+scriptbasename="$(basename "$script")"
if [ "$scriptbasename" != "init-d-script" ] ; then
- script="$1"
- shift
. $script
else
exit 0
Is there anything wrong with this approach?
-- System Information:
Debian Release: 9.3
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (x86_64)
Foreign Architectures: amd64, armhf
Kernel: Linux 4.4.91-mert (SMP w/2 CPU cores)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
Versions of packages sysvinit-utils depends on:
ii init-system-helpers 1.48
ii libc6 2.24-11+deb9u1
ii util-linux 2.29.2-1
sysvinit-utils recommends no packages.
sysvinit-utils suggests no packages.
-- no debconf information
More information about the Pkg-sysvinit-devel
mailing list