Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

init.d-script-does-not-source-init-functions, is it really necessary

59 views
Skip to first unread message

Tong Sun

unread,
Feb 6, 2021, 4:40:03 PM2/6/21
to
Hi,

I have a dilemma,

I have to source /lib/init/init-d-script in my init.d script, **just**
to let the lint warning goes a way, for --

init.d-script-does-not-source-init-functions

However, sourcing /lib/init/init-d-script will break in some cases,
because of which, I had a bug opened against my package.

Would it be a good idea not to source /lib/init/init-d-script, and
overriding the init.d-script-does-not-source-init-functions lint
warning instead? Thx

Paul Wise

unread,
Feb 6, 2021, 10:40:02 PM2/6/21
to
On Sat, Feb 6, 2021 at 9:31 PM Tong Sun wrote:

> I have a dilemma,

I suggest deleting your existing init script and instead using the
example from the init-d-script(5) manual page.

> However, sourcing /lib/init/init-d-script will break in some cases,
> because of which, I had a bug opened against my package.

Please link to the bug report.

--
bye,
pabs

https://wiki.debian.org/PaulWise

Tong Sun

unread,
Feb 7, 2021, 12:40:02 AM2/7/21
to
Thanks for helping Paul.

On Sat, Feb 6, 2021 at 10:30 PM Paul Wise wrote:
>
> On Sat, Feb 6, 2021 at 9:31 PM Tong Sun wrote:
>
> > However, sourcing /lib/init/init-d-script will break in some cases,
> > because of which, I had a bug opened against my package.
>
> Please link to the bug report.

The bug report is at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=958899

Basically I was trying to start/stop a Perl based http server.

> I suggest deleting your existing init script and instead using the
> example from the init-d-script(5) manual page.

I do have one that almost like that,

https://github.com/suntong/dbab/blob/master/bin/dbab

but somehow codes were added when I found cases when things didn't work.

So you are saying something as simple as

#!/usr/bin/env /lib/init/init-d-script
### BEGIN INIT INFO
# Provides: dbab
# Required-Start: $syslog $time $remote_fs
# Required-Stop: $syslog $time $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: run at jobs
# Description: Debian init script to start the daemon
# running at jobs.
### END INIT INFO
DAEMON=/usr/sbin/dbab-svr

without anything else would be good enough?

> > > Letting dh_installinit put code into postinst etc has done the right
> > > thing for me in a package of my own
> >
> > But I'm having a hard time making some senses out of that short sentence.
>
> I think that is referring to the situation where you already have an
> init script and dh_installinit from debhelper takes care of running
> the init script from the postinst when you install the package.

I guess this part can also be taken care of by it, right?

I need to try it out, using this one-line simplest perl http server:

perl -MIO::All -e 'io(":8080")->fork->accept->(sub { $_[0] < io(-x $1
? "./$1 |" : $1) if /^GET \/(.*) / })'

and also, I want to know,

- I need to find a way to debug without doing the package
packaging/installation. I.e., I need to find a way that works, then do
the packaging, instead of the other way around.
- what's the best way to try it out? would `/usr/bin/install -c
my-init-d-script /etc/init.d` under docker works? Testing such
system-bootup cases/scripts had always been a headache for me as I
don't know what is the easiest way.
- where do I find other names for the "Required-Start"/"Required-Stop"
section? I guess that I also need to put more in for my case, network
needs to be started beforehand for example...

thanks again

Paul Wise

unread,
Feb 7, 2021, 3:50:02 AM2/7/21
to
On Sun, Feb 7, 2021 at 5:34 AM Tong Sun wrote:

> The bug report is at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=958899
>
> Basically I was trying to start/stop a Perl based http server.

> I do have one that almost like that,
> https://github.com/suntong/dbab/blob/master/bin/dbab
> but somehow codes were added when I found cases when things didn't work.

I think using /usr/bin/env in the #! line as the init-d-script manual
example does would make the script work on kFreeBSD.

> So you are saying something as simple as
...
> without anything else would be good enough?

In theory yes, I haven't tested it for your case. You would also of
course need to fix the descriptions and arguments though.

Ansgar

unread,
Feb 10, 2021, 4:50:03 AM2/10/21
to
The warning doesn't have anything to do with /lib/init/init-d-script,
but asks to source "/lib/lsb/init-functions" which is a different file.
See the description from `lintian-explain-tags init.d-script-does-not-
source-init-functions`.

So overriding the warning would be bad.

Ansgar
0 new messages