2001-01-12 12:14:51 -05:00
|
|
|
#!/bin/sh
|
2003-09-01 01:13:17 -04:00
|
|
|
# $OpenBSD: INSTALL,v 1.4 2003/09/01 05:13:17 fgsch Exp $
|
2001-01-12 12:14:51 -05:00
|
|
|
#
|
|
|
|
# Pre/post-installation setup of gnats
|
|
|
|
|
|
|
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
|
|
|
PREFIX=${PKG_PREFIX:-/usr/local}
|
2003-05-02 14:17:02 -04:00
|
|
|
CONFIG_FILE=${SYSCONFDIR}/gnats-db.conf
|
2003-06-22 06:05:28 -04:00
|
|
|
USER=_gnats
|
|
|
|
ID=501
|
2001-01-12 12:14:51 -05:00
|
|
|
|
|
|
|
# Function: set up gnats user account.
|
|
|
|
#
|
|
|
|
do_accts()
|
|
|
|
{
|
2003-06-22 06:05:28 -04:00
|
|
|
userinfo -e $USER
|
2001-01-12 12:14:51 -05:00
|
|
|
if [ $? -eq 0 ]; then
|
2003-06-22 06:05:28 -04:00
|
|
|
echo "===> Using account '$USER' for gnats"
|
2001-01-12 12:14:51 -05:00
|
|
|
else
|
|
|
|
echo "===> Creating gnats user"
|
|
|
|
useradd \
|
|
|
|
-g daemon \
|
|
|
|
-c "GNATS database owner" \
|
|
|
|
-d $PREFIX/share/gnats \
|
|
|
|
-s /sbin/nologin \
|
2003-06-22 06:05:28 -04:00
|
|
|
-u $ID $USER
|
2001-01-12 12:14:51 -05:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Function: install the gnats configuration file from the samples
|
|
|
|
#
|
|
|
|
do_configs()
|
|
|
|
{
|
2003-05-02 14:17:02 -04:00
|
|
|
if [ -f ${CONFIG_FILE} ]; then
|
2001-01-12 12:14:51 -05:00
|
|
|
echo ""
|
|
|
|
echo "+---------------"
|
2003-05-02 14:17:02 -04:00
|
|
|
echo "| The existing ${CONFIG_FILE} configuration file"
|
2001-01-12 12:14:51 -05:00
|
|
|
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.
|
2003-05-02 14:17:02 -04:00
|
|
|
install -o root -g wheel -m 644 ${PREFIX}/share/examples/gnats/gnats-db.conf ${CONFIG_FILE}
|
2001-01-12 12:14:51 -05:00
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "+---------------"
|
2003-05-02 14:17:02 -04:00
|
|
|
echo "| The ${CONFIG_FILE} configuration file has been"
|
2001-01-12 12:14:51 -05:00
|
|
|
echo "| installed. Please view this file and change"
|
|
|
|
echo "| the configuration to meet your needs."
|
|
|
|
echo "+---------------"
|
|
|
|
fi
|
2003-06-22 06:05:28 -04:00
|
|
|
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 "+---------------"
|
2001-01-12 12:14:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
# 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
|