1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-09 06:51:44 +00:00
freebsd-ports/net/vserver/files/pkg-install.in
Pav Lucistnik deb72e9dba - Update to 2.43a
- Register UID, provide rc script

PR:		ports/102479
Submitted by:	Andreas S. Wetzel <mickey@netassembly.de> (maintainer)
2006-08-28 20:14:42 +00:00

94 lines
1.8 KiB
Bash

#! /bin/sh
PREFIX=${PKG_PREFIX:-%%PREFIX%%}
VCHATUSER=%%VCHATUSER%%
VCHATGROUP=%%VCHATGROUP%%
UID=128
GID=128
if [ -n "%%DESTDIR%%" ]; then
PW="/usr/sbin/chroot %%DESTDIR%% pw"
CHOWN="/usr/sbin/chroot %%DESTDIR%% chown"
CHMOD="/usr/sbin/chroot %%DESTDIR%% chmod"
MKDIR="/usr/sbin/chroot %%DESTDIR%% mkdir -p"
else
PW="pw"
CHOWN="chown"
CHMOD="chmod"
MKDIR="mkdir"
fi
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