Subject: Re: Game score and config file handling
To: Hubert Feyrer <hubert.feyrer@rz.uni-regensburg.de>
From: Todd Vierling <tv@pobox.com>
List: tech-pkg
Date: 12/02/1998 12:14:13
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
=====

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.

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-)

-- 
-- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com)