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

Re: scores file - how to fix?



On Sun, Mar 01, 1998 at 03:11:34PM +0100, Richard Braakman wrote:
> Adrian Bridgett wrote:
> > I've been looking at how to change my packages to conform to the "new"
> > standard. I was one of those nasty, bad people who tagged scores files as
> > conffiles. I believe this is how to fix it:
> 
> [preinst, postinst]
> 
> The package needs to remove the scores file too, when it is purged.
> Any recommendations/caveats for that?
> 
> Is it enough to rm it in the postrm, or will that leave an empty
> directory around?

I suppose it depends where the scores are located - if they are in:

/var/lib/games/package.scores 

then removing the file should be fine, if they are in:

/var/lib/games/package/scores

then you will need to remove the file and the directory. (If you include the
directory in the .deb, then it isn't removed as the high-score is still in it
when the directory is deleted (2), which occurs before the postrm removes
the score file (6)):

remove & purge
    1. prerm remove
    2. The package's files are removed (except conffiles).
    3. postrm remove
    4. All the maintainer scripts except the postrm are removed.
purge only
    5. The conffiles and any backup files (~-files, ...) are removed.
    6. postrm purge

The scores (and directory if appropriate) should only be removed when the
postrm is called with "purge".

Here is what I intend to do for xsoldier (1:0.96-6 is the new, fixed version):
a) remove /var/lib/games/xsoldier.scores from the .deb and from the list of
conffiles!

preinst:
--------
#!/bin/sh

SCORES=/var/lib/games/xsoldier.scores

if [ "$1" = "upgrade" ] && dpkg --compare-versions "$2" lt "1:0.96-6" ; then
  cp $SCORES $SCORES.temp
fi

#DEBHELPER#


postinst:
---------
#!/bin/sh

SCORES=/var/lib/games/xsoldier.scores

if [ -e $SCORES.temp ]; then
  mv $SCORES.temp $SCORES
fi

touch $SCORES
chmod 0664 $SCORES
chown root.games $SCORES

#DEBHELPER#


postrm:
-------
#!/bin/sh

SCORES=/var/lib/games/xsoldier.scores

if [ "$1" = "purge" ]; then
  rm -f $SCORES
fi

#DEBHELPER#


PS: I meant to send the original message to debian-policy but forgot and
typed in debian-devel :-)

Adrian

email: adrian.bridgett@poboxes.com       | Debian Linux - www.debian.org
http://www.poboxes.com/adrian.bridgett   | Because bloated, unstable 
PGP key available on public key servers  | operating systems are from MS


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: