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

Re: dh_installdeb & postrm



On Sat, Feb 24, 2001 at 05:48:24PM +0100, Eric VB wrote:
> Hi,
> 
> >From what I understand of the doc, debian/tmp/DEBIAN/postrm is generated from
> debian/postrm.debhelper.
> 
> Now if I add a line to debian/postrm.debhelper, everytime I re-build my package
> (dpkg-buildpackage -rfakeroot), this line is erased. Where do I have to declare
> my cutomized commands ?
> 
> man dh_installdeb doesn't help and is a bit confused :
> 
> >       dh_installdeb  automatically  installs the following files
> >       from debian/ into the DEBIAN directory:
> >            package.postinst
> >            package.preinst
> >            package.postrm
> >            package.prerm
> >            package.shlibs
> >            package.conffiles
> >
> >       The postinst, preinst, postrm, and prerm are handled  spe-
> >       cially:  If  a corresponding file named debian/script.deb-
> >       helper exists, the contents of that file are  merged  into
>                                        ^^^^^^^^^^
> debian/script.debhelper ?
> 
> >       the script as follows: If the script exists, then anywhere
>         ^^^^^^^^^^
> debian/script.debhelper again ??
> 
> File merged into itself ?
> 
> >       in it that "#DEBHELPER#" appears, the text  of  the  .deb-
> >       helper  file  is  inserted.  If the script does not exist,
>                                             ^^^^^^^
> debian/script.debhelper ?
> 
> >       then a script is generated
>              ^^^^^^^^
> presumably debian/script.debhelper
> 
> >       from the .debhelper  file.
>                  ^^^^^^^^^^^^^^^^^
> 
> from debian/script.debhelper, right ? 
> 
> I don't get it. Can anyone help ?
> 
> >       The .debhelper  files are created by other debhelper programs,
> >       such as dh_installmenu(1) , and  are  shell  script  frag-
> >       ments.
> 
Little less confusing if I comment here, rather than inline, I think.

Create files named debian/post{rm,inst} and debian/pre{rm,inst} if you
need to add specific code for one package. For multiple debs from same
source create debian/$package.post{rm,inst} debian/$package.pre{rm,inst}

If you use debhelper commands (ie dh_installdocs, dh_isntallman,
dh_installmenu) inside your debian/rules, then at the bottom of your
hand crafted maintainer scripts (debian/[$package]{post,pre}.{rm,inst})
add on a line by itself #DEBHELPER#.

That will cause the dh_scripts to automatically merg code into your hand
crafted scripts before they are installed into
debian/{$package,tmp}/DEBIAN.

For instance, the #DEBHELPER# token causes dh_installdocs to add code to
automatically create a symlink from /usr/share/doc/$package to
/usr/doc/$package and remove it upon package removal.

HTH

Gordon Sadler



Reply to: