Bug#913247: Please provide a C implementation of /lib/init/init-d-script
Mert Dirik
mertdirik at gmail.com
Wed Nov 21 23:18:37 GMT 2018
On Tue, 13 Nov 2018 20:22:16 +0000 Dmitry Bogatov <KAction at debian.org>
wrote:
>
> [Adding systemd maintainers into thread]
> (We are discussing #826214)
>
> [2018-11-11 22:37] Michael Biebl <biebl at 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?
>
>
Hi,
I noticed the new snippet in the man page of experimental version uses the
#! /usr/bin/env /lib/init/init-d-script
shebang, which doesn't work with systemd redirection. I don't know any
packages in the archive using /lib/init/init-d-script in the shebang
line currently but I fear some scripts may start to use the new variant
(thus hitting #826214 again).
Can you please consider changing it with the snippet in the old
/etc/init.d/skeleton (the one using the INIT_D_SCRIPT_SOURCED trick), at
least until a better solution can be found for this or #826214)
More information about the Debian-init-diversity
mailing list