Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

package.init is not getting installed

I have a project.init file in the debian directory (along with rules, control, etc), and I have dh_installinit in my rules file (in the binary-arch rule).

When dpkg-buildpackage completes, the init script has been copied to debian/project/etc/init.d/project, and the various pre/post scripts have been created.

However, when I actually install the .deb (with dpkg -i), the init.d script does not get installed, so I must be missing part of this process. The "New Maintainer's Guide" is pretty sparse on init.d details (it basically says not to use them, because they are too advanced).

The verbose output of the dh_installinit command is:

dh_installinit
    install -p -m755 debian/project.init debian/project/etc/init.d/project
    echo "# Automatically added by dh_installinit">> debian/project.postinst.debhelper
    sed "s/#SCRIPT#/project/;s/#INITPARMS#/defaults/;s/#ERROR_HANDLER#/exit \$?/" /usr/share/debhelper/autoscripts/postinst-init >> debian/project.postinst.debhelper
    echo '# End automatically added section' >> debian/project.postinst.debhelper
    echo "# Automatically added by dh_installinit">> debian/project.prerm.debhelper
    sed "s/#SCRIPT#/project/;s/#INITPARMS#/defaults/;s/#ERROR_HANDLER#/exit \$?/" /usr/share/debhelper/autoscripts/prerm-init >> debian/project.prerm.debhelper
    echo '# End automatically added section' >> debian/project.prerm.debhelper
    echo "# Automatically added by dh_installinit">> debian/project.postrm.debhelper
    sed "s/#SCRIPT#/project/;s/#INITPARMS#/defaults/;s/#ERROR_HANDLER#/exit \$?/" /usr/share/debhelper/autoscripts/postrm-init >> debian/project.postrm.debhelper
    echo '# End automatically added section' >> debian/project.postrm.debhelper
like image 790
Tony Meyer Avatar asked May 26 '09 06:05

Tony Meyer


2 Answers

Does your package have an entry for your init script under the Conffiles block in /var/lib/dpkg/status, e.g.

Package: <project>
...
Conffiles:
 /etc/init.d/<project> d41d8cd98f00b204e9800998ecf8427e

and does /var/lib/dpkg/info/<project>.conffiles contain /etc/init.d/<project>?

Here's what's happening...

init scripts are marked as configuration files by default, since they live under /etc.1

I'm guessing you installed the package, removed the init file, then reinstalled the package.

In this case, removing the init file counts as modifying it2, and dpkg refuses to "overwrite" the "configuration file".

You should be able to fix the problem by removing the Conffiles section from /var/lib/dpkg/status.

Notes:

  1. conffiles - Debian New Maintainer's Guide
  2. An empty file has MD5sum d41d8cd98f00b204e9800998ecf8427e, but any non-matching checksum will cause the same behavior
like image 58
Mikel Avatar answered Sep 23 '22 00:09

Mikel


I believe you should be looking at the utility script "update-rc.d" which takes care of creating / removing symlinks in /etc/init.d/ .

Use this script in the DEBIAN control files "postinst" & "postrm".

E.g. for 'postinst': update-rc.d mswitch start 20 2 3 4 5 . stop 0 1 6 .

E.g. for 'postrm': update-rc.d mswitch remove

like image 24
jldupont Avatar answered Sep 20 '22 00:09

jldupont