Subject: Re: Game score and config file handling
To: <>
From: Simon Burge <simonb@telstra.com.au>
List: tech-pkg
Date: 12/03/1998 13:07:36
So, does anyone mind if I create a $PREFIX/share/games, $PREFIX/var and
a $PREFIX/var/games in mk/NetBSD.pkg.dist?  If this is ok, I'll start
looking at existing games to move their stuff out of share and into
share/games (but no promised before Xmas :).


On Wed, 2 Dec 1998, Todd Vierling wrote:

> On Wed, 2 Dec 1998, Hubert Feyrer wrote:
> 
> : Following up the recent discussion, i'd like to offer the following
> : solutions for handling game score files and config files. The idea on both
> : is to keep them on deleting, and generate them only if they aren't already
> : present, with a little trick for config files:
> 
> This is already done in many pkgs.  Simply put in pseudo-Make and
> pseudo-PLIST,
> 
> pkg Makefile...
> 
> =====
> do-install:
> 	${INSTALL_DATA} ${WRKSRC}/mygame_score \
> 		${PREFIX}/var/mygame_score.dist
> post-install:
> 	@if [ ! -f ${PREFIX}/var/mygame_score ]; then \
> 		${CP} -p ${PREFIX}/var/mygame_score.dist \
> 			${PREFIX}/var/mygame_score; \
> 	fi
> =====

I just tried the approach of getting the game to install to the dist
name, which drops the need for the do-install rule.  Seems to work fine,
but I can see how it may be easier for some packages to have a separate
do-install rule.  Thinking more, should the dist score file go into
share/games, and the real score file go to var/games?  I guess it really
doesn't matter in the scheme of things...

> PLIST...
> 
> =====
> var/mygame_score.dist
> @exec if [ ! -f %D/var/mygame_score ]; then cp -p %D/var/mygame_score.dist %D/var/mygame_score; fi
> =====
> 
> The file is created if needed, but not deleted or messed with otherwise on
> delete or delete-and-reinstall.

Seems to work well!

> Note that just because I proposed an implementation of Hubert's suggestion
> does not mean I volunteer to fix anything I haven't already fixed.  8-)

I _might_ have a look at other games, but again no promises...

Simon.