[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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



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


Reply to: