(debian-policy.info)Managing the links


Next: Running initscripts Up: Interfacing with init systems
Enter node , (file) or (file)node

9.3.3.1 Managing the links
..........................

The program ‘update-rc.d’ is provided for package maintainers to arrange
for the proper creation and removal of ‘/etc/rcn.d’ symbolic links, or
their functional equivalent if another method is being used.  This may
be used by maintainers in their packages’ ‘postinst’ and ‘postrm’
scripts.

You must not include any ‘/etc/rcn.d’ symbolic links in the actual
archive or manually create or remove the symbolic links in maintainer
scripts; you must use the ‘update-rc.d’ program instead.  (The former
will fail if an alternative method of maintaining runlevel information
is being used.)  You must not include the ‘/etc/rcn.d’ directories
themselves in the archive either.  (Only the ‘sysvinit’ package may do
so.)

To get the default behavior for your package, put in your ‘postinst’
script:

     update-rc.d package defaults

and in your ‘postrm’:

     if [ "$1" = purge ]; then
         update-rc.d package remove
     fi

The default behaviour is to enable autostarting your package’s daemon.
The local administrator can override this using the command ‘update-rc.d
package disable’.  If, however, the daemon should not be autostarted
unless the local administrator has explicitly requested this, instead
add to your ‘postinst’ script:

     update-rc.d package defaults-disabled

and add a dependency on ‘init-system-helpers (>= 1.50)’, which
introduced the ‘defaults-disabled’ option.  Then the local administrator
can enable autostarting the daemon using the command ‘update-rc.d
package enable’.

An older practice, which should not be used, was to include a line like
‘DISABLED=yes’ in the package’s ‘/etc/default’ file.  The package’s init
script would not start the service until the local system administrator
changed this to ‘DISABLED=no’, or similar.  The problem with this
approach was that it hides from the init system whether or not the
daemon should actually be started, which leads to inconsistent and
confusing behavior: ‘service <package> start’ may return success but not
start the service; services with a dependency on this service will be
started even though the service isn’t running; and init system status
commands may incorrectly claim that the service was started.

Note that if your package changes runlevels or priority, you may have to
remove and recreate the links, since otherwise the old links may
persist.  Refer to the documentation of ‘update-rc.d’.

For more information about using ‘update-rc.d’, please consult its man
page, update-rc.d(8).

It is easiest for packages not to call ‘update-rc.d’ directly, but
instead use debhelper programs that add the required ‘update-rc.d’ calls
automatically.  See ‘dh_installinit’, ‘dh_installsystemd’, etc.


automatically generated by info2www version 1.2.2.9