openbsd-ports/net/jabberd/pkg/INSTALL

100 lines
3.1 KiB
Plaintext

#!/bin/sh
# $OpenBSD: INSTALL,v 1.1.1.1 2004/05/29 13:12:30 jakob Exp $
#
# Pre/post-installation setup of jabberd
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
UID=533
GID=533
do_usergroup_install()
{
# Create jabberd user and group
groupinfo -e ${JABBERDGROUP}
if [ $? -eq 0 ]; then
echo "===> Using ${JABBERDGROUP} group for jabberd"
else
echo "===> Creating ${JABBERDGROUP} group for jabberd"
groupadd -g $GID ${JABBERDGROUP}
fi
userinfo -e ${JABBERDUSER}
if [ $? -eq 0 ]; then
echo "===> Using ${JABBERDUSER} user for jabberd"
else
echo "===> Creating ${JABBERDUSER} user for jabberd"
useradd -g ${JABBERDGROUP} -d /nonexistent -L daemon -c 'jabberd account' -s /bin/sh -u $UID ${JABBERDUSER}
fi
}
do_jabberddir_install()
{
install -d -o ${JABBERDUSER} -g ${JABBERDGROUP} -m 771 ${JABBERDDIR}
install -d -o ${JABBERDUSER} -g ${JABBERDGROUP} -m 775 ${JABBERDDIR}/pid
install -d -o ${JABBERDUSER} -g ${JABBERDGROUP} -m 775 ${JABBERDDIR}/log
}
do_notice_conf()
{
echo
echo "+---------------"
echo "| The existing $1 configuration files in ${CONFIG_DIR} have NOT"
echo "| been changed. You may want to compare them to the current samples in"
echo "| ${EXAMPLES}, and update your configuration"
echo "| files as needed."
}
do_install_conf()
{
install -d -o root -g wheel -m 750 ${CONFIG_DIR}
install -o ${JABBERDUSER} -g ${JABBERDGROUP} -m 640 ${EXAMPLES}/jabberd.cfg ${CONFIG_DIR}/jabberd.cfg
install -o ${JABBERDUSER} -g ${JABBERDGROUP} -m 640 ${EXAMPLES}/c2s.xml ${CONFIG_DIR}/c2s.xml
install -o ${JABBERDUSER} -g ${JABBERDGROUP} -m 640 ${EXAMPLES}/resolver.xml ${CONFIG_DIR}/resolver.xml
install -o ${JABBERDUSER} -g ${JABBERDGROUP} -m 640 ${EXAMPLES}/router-users.xml ${CONFIG_DIR}/router-users.xml
install -o ${JABBERDUSER} -g ${JABBERDGROUP} -m 640 ${EXAMPLES}/router.xml ${CONFIG_DIR}/router.xml
install -o ${JABBERDUSER} -g ${JABBERDGROUP} -m 640 ${EXAMPLES}/s2s.xml ${CONFIG_DIR}/s2s.xml
install -o ${JABBERDUSER} -g ${JABBERDGROUP} -m 640 ${EXAMPLES}/sm.xml ${CONFIG_DIR}/sm.xml
install -d -o ${JABBERDUSER} -g ${JABBERDGROUP} -m 750 ${CONFIG_DIR}/templates
install -o ${JABBERDUSER} -g ${JABBERDGROUP} -m 640 ${EXAMPLES}/templates/roster.xml ${CONFIG_DIR}/roster.xml
echo
echo "+---------------"
echo "| The $1 configuration files have been installed in ${CONFIG_DIR}."
echo "| Please view this file and change the configuration to meet your needs."
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 ${JABBERDDIR} ]; then
do_jabberddir_install
fi
if [ ! -d ${CONFIG_DIR} ]; then
do_install_conf $1
elif [ ! -f ${CONFIG_DIR}/jabberd.cfg ]; then
do_install_conf $1
else
do_notice_conf $1
fi
;;
*)
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
;;
esac
exit 0