openbsd-ports/net/silc-server/pkg/INSTALL
2002-12-29 21:22:13 +00:00

91 lines
2.2 KiB
Plaintext

#!/bin/sh
# $OpenBSD: INSTALL,v 1.2 2002/12/29 21:22:13 brad Exp $
#
# Pre/post-installation setup of silc-server
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
CONFIG_DIR=${SYSCONFDIR}/silcd
LOG_DIR=/var/log/silcd
SAMPLE_CONFIG_DIR=$PREFIX/share/examples/silcd
SILCDUSER=silcd
SILCDGROUP=silcd
do_usergroup_install()
{
# Create silc-server user and group
groupinfo -e $SILCDGROUP
if [ $? -eq 0 ]; then
echo "===> Using $SILCDGROUP group for silc-server"
else
echo "===> Creating $SILCDGROUP group for silc-server"
groupadd $SILCDGROUP
fi
userinfo -e $SILCDUSER
if [ $? -eq 0 ]; then
echo "===> Using $SILCDUSER user for silc-server"
else
echo "===> Creating $SILCDUSER user for silc-server"
useradd -g $SILCDGROUP -d /nonexistent -L daemon -c ' Silc-server Account' -s /sbin/nologin $SILCDUSER
fi
}
do_notice()
{
echo
echo "+---------------"
echo "| The existing silcd 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 silcd -g silcd -m 700 $CONFIG_DIR
install -d -o silcd -g silcd -m 700 $LOG_DIR
install -o silcd -g silcd -m 600 $SAMPLE_CONFIG_DIR/silcd.conf $CONFIG_DIR/silcd.conf
install -o silcd -g silcd -m 600 $SAMPLE_CONFIG_DIR/silcalgs.conf $CONFIG_DIR/silcalgs.conf
echo
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 "+---------------"
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/silcd.conf ]; then
do_install $1
else
do_notice $1
fi
;;
*)
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
;;
esac
exit 0