openbsd-ports/audio/opennap/pkg/INSTALL
2003-06-22 10:01:35 +00:00

93 lines
2.3 KiB
Plaintext

#!/bin/sh
# $OpenBSD: INSTALL,v 1.3 2003/06/22 10:01:35 sturm Exp $
#
# Pre/post-installation setup of opennap
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
CONFIG_DIR=${SYSCONFDIR}/opennap
SAMPLE_CONFIG_DIR=$PREFIX/share/examples/opennap
OPENNAPUSER=_opennap
OPENNAPGROUP=_opennap
ID=500
do_usergroup_install()
{
# Create Opennap user and group
if groupinfo -e $OPENNAPGROUP; then
echo "===> Using $OPENNAPGROUP group for Opennap"
else
echo "===> Creating $OPENNAPGROUP group for Opennap"
groupadd -g $ID $OPENNAPGROUP
fi
if userinfo -e $OPENNAPUSER; then
echo "===> Using $OPENNAPUSER user for Opennap"
else
echo "===> Creating $OPENNAPUSER user for Opennap"
useradd -g $OPENNAPGROUP -d /nonexistent -L daemon -c 'Opennap Account' -s /sbin/nologin -u $ID $OPENNAPUSER
fi
}
do_notice()
{
echo
echo "+---------------"
echo "| The existing opennap configuration files in $CONFIG_DIR,"
echo "| have NOT been changed. You may want to compare them to the"
echo "| current sample files in $SAMPLE_CONFIG_DIR,"
echo "| and update your configuration as needed."
echo "+---------------"
echo
}
do_install()
{
install -d -o $OPENNAPUSER -g $OPENNAPGROUP -m 700 $CONFIG_DIR
echo "admin opennap email@here.com Elite 0 0" > $CONFIG_DIR/users
chown $OPENNAPUSER:$OPENNAPGROUP $CONFIG_DIR/users
chmod 600 $CONFIG_DIR/users
echo
echo "+---------------"
echo "| The $1 configuration files have been installed into"
echo "| $CONFIG_DIR. Please view these files and change the configuration"
echo "| to meet your needs."
echo "|"
echo "| A default administrator user has been created. The user name"
echo "| is 'admin', password 'opennap'. You will probably want to"
echo "| change these. To do so, edit the file $CONFIG_DIR/users."
echo "|"
echo "+---------------"
echo
}
# 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)
do_usergroup_install
;;
POST-INSTALL)
if [ ! -d $CONFIG_DIR ]; then
do_install $1
elif [ ! -f $CONFIG_DIR/users ]; then
do_install $1
else
do_notice $1
fi
;;
*)
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
;;
esac
exit 0