Re: postinst?
> Hi,
> I am building a package, using debhelper scripts. Now I have to call a
> program (to create a score file with defined ownership) from the postinst.
> In the docs I found something about autoscript, but it seems I can not call
> it from debian rules. So how do I add a programm call in postinst using
> debhelper? (I could probably write the postinst myself, but I dont want to).
All that debhelper will do is to place appropriate lines in the
postinst to handle "standard" things such as info file installation,
window manager installation, suidregister and so forth. As soon as
you want to do something package-specific, you have to write your own
postinst. Incidentally, for debhelper to put *anything* in a
maintainer script ({pre,post}{inst,rm}), you need to have at least the
following minimal script:
#! /bin/sh
#DEBHELPER#
I don't believe that debhelper will create the script otherwise.
For your particular problem, you probably want something like (note
that this does nothing except change the timestamp if the file already
exists):
postinst:
---------
#! /bin/sh
if [ "$1" = configure ]
then
if [ -d /var/games ]; then DIR=/var/games; else DIR=/var/lib/games; fi
touch $DIR/mylog
chown root.games $DIR/mylog
chmod 664 $DIR/mylog
fi
postrm:
-------
#! /bin/sh
if [ "$1" = purge ]
then
if [ -d /var/games ]
then rm /var/games/mylog
else rm /var/lib/games/mylog
fi
fi
Julian
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Julian Gilbey, Dept of Maths, QMW, Univ. of London. J.D.Gilbey@qmw.ac.uk
Debian GNU/Linux Developer, see http://www.debian.org/~jdg
Reply to:
- References:
- postinst?
- From: "Christian T. Steigies" <steigies@physik.uni-kiel.de>