#!/bin/sh
# $OpenBSD: INSTALL,v 1.1 2001/08/11 17:18:50 lebel Exp $
#
# Pre/post-installation setup of angband

# 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/angband

# Function: install the directories and files for angband
#
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
    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
