8.4. Installation and Removal of init.d Files

An init.d file is installed in /etc/init.d (which may be a symlink to another location). This can be done by the package installer. See Script Names. During the package's postinstall script, the program /usr/lib/lsb/install_initd configures the distribution's boot script system to call the package's init.d file at the appropriate time.

Note: For example, install_initd might create symbolic links in /etc/rc2.d and other such directories which point to the files in /etc/init.d (or it might update a database, or some other mechanism). The init.d files themselves should already be in /etc/init.d before running install_initd.

The install_initd program takes a single argument, the pathname to the /etc/init.d file. For example:

	/usr/lib/lsb/install_initd /etc/init.d/example.com-coffeed

The install_initd program shall return an exit status of zero if the init.d file has been successfully installed or if the the init.d file was already installed. If the required boot facilities cannot be fulfilled an exit status of one shall be returned and the init.d file shall not be installed.

When a software package is removed, the package's preuninstall script shall call /usr/lib/lsb/remove_initd and pass the pathname to the /etc/init.d file. The package manager is still responsible for removing the /etc/init.d file; the remove_initd program is provided in case the distribution needs to clean up any other modifications in the distribution's boot script system that might have been made by the install_initd program. For example:

	/usr/lib/lsb/remove_initd /etc/init.d/example.com-coffeed

The remove_initd program shall return an exit status of zero if the init.d file has been successfully removed or if the the init.d file is not installed. If another init.d file which depends on a boot facility provided by this init.d file is installed, an exit status of one shall be returned and the init.d file shall remained installed.

Note: There should be a tool available to the user (e.g., RedHat's chkconfig) which can be used by the system administrator to easily manipulate at which init levels a particular init.d script is started or stopped. This specification currently does not specify such an interface, however.