[Adding systemd maintainers into thread]
(We are discussing #826214)

[2018-11-11 22:37] Michael Biebl <bi...@debian.org>
> > #!/lib/init/init-d-script?
> 
> It doesn't work with #!/lib/init/init-d-script either.
> 
> Only
> ============================
> #!/bin/sh
> 
> if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
>     set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
> fi
> ============================
> currently works wrt to systemctl redirection.

At least it does not feel magic. In case of #!/lib/init/init-d-script,
$0 = /lib/init/init-d-script; in case of sourcing $0 is path to script
(/etc/init.d/foo).

Now, issue seems to be /lib/lsb/init-functions.d/40-systemd from
bin:systemd. On line 7 we read:

        prog=${0##*/}

As far as I know, there is no way to modify "$0". So we have two
options:

 * have systemd folks use `${__init_d_script_name##*/}' in
   `40-systemd' instead of `$0'

 * write wrapper in C, which sets $0 to value, expected by `40-systemd'.
   Actually, there is number of utilities floating around, which set $0
   to arbitrary value (`chpst' from bin:runit is one of them :)), but we
   do not want to add new dependency to essentail sysvinit-utils, don't
   we?

Opinions?

Reply via email to