freebsd-ports/net/vserver/files/pkg-install.in
Gabor Kovesdan 42542fb076 - Remove the DESTDIR modifications from individual ports as we have a new,
fully chrooted DESTDIR, which does not need such any more.

Sponsored by:	Google Summer of Code 2007
Approved by:	portmgr (pav)
2007-08-04 11:41:30 +00:00

81 lines
1.6 KiB
Bash

#! /bin/sh
PREFIX=${PKG_PREFIX:-%%PREFIX%%}
VCHATUSER=%%VCHATUSER%%
VCHATGROUP=%%VCHATGROUP%%
UID=128
GID=128
PW="pw"
CHOWN="chown"
CHMOD="chmod"
MKDIR="mkdir"
if [ "$2" = "PRE-INSTALL" ]; then
if ! ${PW} groupshow ${VCHATGROUP} 2>/dev/null 1>&2; then
if ${PW} groupadd ${VCHATGROUP} -g $GID; then
echo "=> Added group \"${VCHATGROUP}\"."
else
echo "=> Adding group \"${VCHATGROUP}\" failed."
exit 1
fi
fi
if ! ${PW} usershow ${VCHATUSER} 2>/dev/null 1>&2; then
if ${PW} useradd ${VCHATUSER} -u $UID -g ${VCHATGROUP} -h - \
-s "/sbin/nologin" -d "/nonexistent" \
-c "VChat Conferencing System"; \
then
echo "=> Added user \"${VCHATUSER}\"."
else
echo "=> Adding user \"${VCHATUSER}\" failed."
exit 1
fi
fi
elif [ "$2" = "POST-INSTALL" ]; then
if [ ! -d "${PREFIX}/etc/vchat" ]; then
${MKDIR} ${PREFIX}/etc/vchat || exit 1
fi
${CHOWN} ${VCHATUSER}:${VCHATGROUP} ${PREFIX}/etc/vchat
${CHMOD} 755 ${PREFIX}/etc/vchat
if [ ! -f "${PREFIX}/etc/vchat/user.db" ]; then
cat << -EOT-
****************************** IMPORTANT NOTE *******************************
Before starting vserver into normal operations for the first time, you
need to create an initial user database file "${PREFIX}/etc/vchat/user.db".
This is accomplished by running the following command sequence:
su -f -m ${VCHATUSER} -c "${PREFIX}/sbin/vserver /BASEDIR=${PREFIX}/etc/vchat /CREATEUDB"
*****************************************************************************
-EOT-
else
${CHOWN} ${VCHATUSER}:${VCHATGROUP} ${PREFIX}/etc/vchat/user.db
${CHMOD} 600 ${PREFIX}/etc/vchat/user.db
fi
fi
exit 0