openbsd-ports/databases/gnats/pkg/INSTALL

85 lines
2.0 KiB
Plaintext
Raw Normal View History

#!/bin/sh
# $OpenBSD: INSTALL,v 1.4 2003/09/01 05:13:17 fgsch Exp $
#
# Pre/post-installation setup of gnats
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
CONFIG_FILE=${SYSCONFDIR}/gnats-db.conf
USER=_gnats
ID=501
# Function: set up gnats user account.
#
do_accts()
{
userinfo -e $USER
if [ $? -eq 0 ]; then
echo "===> Using account '$USER' for gnats"
else
echo "===> Creating gnats user"
useradd \
-g daemon \
-c "GNATS database owner" \
-d $PREFIX/share/gnats \
-s /sbin/nologin \
-u $ID $USER
fi
}
# Function: install the gnats configuration file from the samples
#
do_configs()
{
if [ -f ${CONFIG_FILE} ]; then
echo ""
echo "+---------------"
echo "| The existing ${CONFIG_FILE} configuration file"
echo "| has NOT been changed. You may want to compare it to the"
echo "| current sample file, ${PREFIX}/share/examples/gnats/gnats-db.conf"
echo "| and update your configuration as needed."
echo "+---------------"
else
# Install config files.
install -o root -g wheel -m 644 ${PREFIX}/share/examples/gnats/gnats-db.conf ${CONFIG_FILE}
echo ""
echo "+---------------"
echo "| The ${CONFIG_FILE} configuration file has been"
echo "| installed. Please view this file and change"
echo "| the configuration to meet your needs."
echo "+---------------"
fi
echo "| WARNING!"
echo "|"
echo "| This port has changed its user from 'gnats' to '_gnats'. If you"
echo "| installed this port before, ensure all permissions are set"
echo "| correctly and then \"rmuser gnats\"."
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_accts
;;
POST-INSTALL)
do_configs
echo "===> See ${PREFIX}/share/doc/gnats/README.OpenBSD for further configuration"
;;
*)
echo "Usage: `basename $0` distname <PRE-INSTALL|POST-INSTALL>" >&2
exit 1
;;
esac
exit 0