modify zangband in order to use /var/games/zangband for

user modifiable files (like score, bone and save files). Add
pkg/INSTALL and pkg/DEINSTALL to manage them.
This commit is contained in:
lebel 2001-08-11 16:30:13 +00:00
parent d1940ef911
commit e9933d29cb
4 changed files with 119 additions and 20 deletions

View File

@ -0,0 +1,39 @@
$OpenBSD: patch-src_init2_c,v 1.1 2001/08/11 16:30:13 lebel Exp $
--- src/init2.c.orig Sat Aug 11 00:19:17 2001
+++ src/init2.c Sat Aug 11 00:20:13 2001
@@ -130,21 +130,18 @@ void init_file_paths(char *path)
#else /* VM */
-
+#define OPENBSD_VAR "/var/games/zangband"
/*** Build the sub-directory names ***/
/* Build a path name */
- strcpy(tail, "apex");
- ANGBAND_DIR_APEX = string_make(path);
+ ANGBAND_DIR_APEX = string_make("/var/games/zangband/apex");
/* Build a path name */
- strcpy(tail, "bone");
- ANGBAND_DIR_BONE = string_make(path);
+ ANGBAND_DIR_BONE = string_make("/var/games/zangband/bone");
/* Build a path name */
- strcpy(tail, "data");
- ANGBAND_DIR_DATA = string_make(path);
+ ANGBAND_DIR_DATA = string_make("/var/games/zangband/data");
/* Build a path name */
strcpy(tail, "edit");
@@ -171,8 +168,7 @@ void init_file_paths(char *path)
ANGBAND_DIR_PREF = string_make(path);
/* Build a path name */
- strcpy(tail, "save");
- ANGBAND_DIR_SAVE = string_make(path);
+ ANGBAND_DIR_SAVE = string_make("/var/games/zangband/save");
#ifdef PRIVATE_USER_PATH

View File

@ -0,0 +1,25 @@
#!/bin/sh
# $OpenBSD: DEINSTALL,v 1.1 2001/08/11 16:30:13 lebel Exp $
#
# dopewars de-installation
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
SCORE_DIR=/var/games/zangband
if [ -f $SCORE_FILE ]; then
echo
echo "+---------------"
echo "| To completely deinstall the $1 package you need to perform"
echo "| this step as root:"
echo "|"
echo "| rm -rf $SCORE_DIR"
echo "|"
echo "| Do not do this if you plan on re-installing $1"
echo "| at some future time."
echo "+---------------"
echo
fi
exit 0

View File

@ -0,0 +1,50 @@
#!/bin/sh
# $OpenBSD: INSTALL,v 1.1 2001/08/11 16:30:13 lebel Exp $
#
# Pre/post-installation setup of zangband
# exit on errors, use a sane path and install prefix
#
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
SCORE_DIR=/var/games/zangband
# Function: install the directories and files for zangband
#
do_install()
{
install -m 775 -d $SCORE_DIR
install -m 775 -d $SCORE_DIR/apex
install -m 775 -d $SCORE_DIR/save
install -m 775 -d $SCORE_DIR/data
install -m 775 -d $SCORE_DIR/bone
cp $PREFIX/share/zangband/apex/* $SCORE_DIR/apex
chown -R root.games $SCORE_DIR
}
# verify proper execution
#
if [ $# -ne 2 ]; then
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
fi
# Verify/process the command
#
case $2 in
PRE-INSTALL)
: nothing to pre-install for this port
;;
POST-INSTALL)
if [ ! -d $SCORE_DIR ]; then
do_install $1
fi
;;
*)
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
;;
esac
exit 0

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2001/07/28 16:33:39 lebel Exp $
@comment $OpenBSD: PLIST,v 1.2 2001/08/11 16:30:13 lebel Exp $
bin/zangband
share/zangband/apex/readme.txt
share/zangband/apex/z_scores.raw
@ -116,29 +116,14 @@ share/zangband/pref/xtra-gcu.prf
share/zangband/pref/xtra-new.prf
share/zangband/pref/xtra-xxx.prf
@exec mkdir -p %D/share/zangband/xtra
@dirrm share/zangband/xtra
@exec mkdir -p %D/share/zangband/user
@dirrm share/zangband/user
@exec mkdir -p %D/share/zangband/script
@dirrm share/zangband/script
@exec mkdir -p %D/share/zangband/save
@dirrm share/zangband/pref
@exec mkdir -p %D/share/zangband/info
@dirrm share/zangband/xtra
@dirrm share/zangband/script
@dirrm share/zangband/pref
@dirrm share/zangband/info
@dirrm share/zangband/apex
@dirrm share/zangband/help
@dirrm share/zangband/file
@dirrm share/zangband/edit
@exec mkdir -p %D/share/zangband/data
@exec mkdir -p %D/share/zangband/bone
@exec chmod 0775 %D/share/zangband/apex
@exec chmod 0775 %D/share/zangband/data
@exec chmod 0775 %D/share/zangband/save
@exec chmod 0775 %D/share/zangband/user
@unexec rm -f %D/share/zangband/apex/*
@unexec rm -f %D/share/zangband/data/*
@unexec rm -f %D/share/zangband/save/*
@dirrm share/zangband/save
@dirrm share/zangband/data
@dirrm share/zangband/bone
@dirrm share/zangband/apex
@dirrm share/zangband