From e9933d29cbc129e8fd1698b2522331dc60e863a0 Mon Sep 17 00:00:00 2001 From: lebel Date: Sat, 11 Aug 2001 16:30:13 +0000 Subject: [PATCH] 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. --- games/zangband/patches/patch-src_init2_c | 39 ++++++++++++++++++ games/zangband/pkg/DEINSTALL | 25 ++++++++++++ games/zangband/pkg/INSTALL | 50 ++++++++++++++++++++++++ games/zangband/pkg/PLIST | 25 +++--------- 4 files changed, 119 insertions(+), 20 deletions(-) create mode 100644 games/zangband/patches/patch-src_init2_c create mode 100644 games/zangband/pkg/DEINSTALL create mode 100644 games/zangband/pkg/INSTALL diff --git a/games/zangband/patches/patch-src_init2_c b/games/zangband/patches/patch-src_init2_c new file mode 100644 index 00000000000..99e7ef0a389 --- /dev/null +++ b/games/zangband/patches/patch-src_init2_c @@ -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 + diff --git a/games/zangband/pkg/DEINSTALL b/games/zangband/pkg/DEINSTALL new file mode 100644 index 00000000000..8c83b9484a1 --- /dev/null +++ b/games/zangband/pkg/DEINSTALL @@ -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 diff --git a/games/zangband/pkg/INSTALL b/games/zangband/pkg/INSTALL new file mode 100644 index 00000000000..d18b35ee0d9 --- /dev/null +++ b/games/zangband/pkg/INSTALL @@ -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 diff --git a/games/zangband/pkg/PLIST b/games/zangband/pkg/PLIST index 3d3d7571c63..f5813b3ca92 100644 --- a/games/zangband/pkg/PLIST +++ b/games/zangband/pkg/PLIST @@ -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