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

Re: solving the network-manager-in-gnome problem

On Mon, Jul 30, 2012 at 11:12:43AM +0200, Vincent Lefevre wrote:
> > I do believe that whenever an initscript is called with the argument
> > "start", it should bloody well start, and not exit after doing
> > nothing because I haven't edited some scarcely related file
> > somewhere.
> As long as scripts are allowed to execute init scripts directly with
> "start" or "restart" (see rsync postinst script, for instance), this
> must not be the case. Otherwise there would be no means to disable a
> daemon (uninstalling the package would not be a satisfactory solution
> because the client may still be useful, such as with rsync).

Package maintainer scripts are _not_ allowed to execut init.d scripts
directly. They have to do it via invoke-rc.d, which obeys runlevel
configurations and local policy made by the sysadmin (using the
/usr/sbin/policy-rc.d interface, which is not the world's greatest one,
but at least it's there).

I'm writing this on a machine running squeeze, so this may be a bit
different in later versions, but here's the snippet:

    if [ -x /etc/init.d/rsync ]; then
        if dpkg --compare-versions "$oldversion" lt "3.0.7-2"; then
            update-rc.d -f rsync remove

        update-rc.d rsync start 50 2 3 4 5 . >/dev/null
        if [ -x /usr/sbin/invoke-rc.d ]; then
            invoke-rc.d rsync restart
            /etc/init.d/rsync restart

This invokes the service ("runs the init.d script") with invoke-rc.d, if
available. The rsync postscript should not need to check for invoke-rc.d
anymore, it's been available in a required package for a long time now,
but it shouldn't matter, either.

I wrote a book: http://gtdfh.branchable.com/

Attachment: signature.asc
Description: Digital signature

Reply to: