pkgsrc/misc/jitterbug/INSTALL

53 lines
1.2 KiB
Text

#!/bin/sh
#
# $NetBSD: INSTALL,v 1.1 2001/11/01 01:28:24 zuntum Exp $
PKGNAME=$1
STAGE=$2
JB_USER=@JB_USER@
JB_USERID=@JB_USERID@
JB_GROUP=@JB_GROUP@
JB_GROUPID=@JB_GROUPID@
ADDUSER=@ADDUSER@
ADDGROUP=@ADDGROUP@
CHGRP=@CHGRP@
ID=@ID@
TOUCH=@TOUCH@
RM=@RM@
if [ "$STAGE" != "PRE-INSTALL" ];
then
exit 0
fi
# We need to check that ${JB_GROUP} exists before adding the user.
#
${TOUCH} "/tmp/grouptestjitterbug.$$"
${CHGRP} ${JB_GROUP} "/tmp/grouptestjitterbug.$$" >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Group '${JB_GROUP}' already exists...proceeding."
else
echo "Creating '${JB_GROUP}' group..."
if ! ${ADDGROUP} -g ${JB_GROUPID} ${JB_GROUP}
then
echo "Can't add group ${JB_GROUP} with gid ${JB_GROUPID}"
echo "Please do it manually and restart installation."
${RM} -f "/tmp/grouptestjitterbug.$$"
exit 1
fi
echo "Done."
fi
${RM} -f "/tmp/grouptestjitterbug.$$"
${ID} ${JB_USER} >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "User '${JB_USER}' already exists...proceeding."
else
echo "Creating '${JB_USER}' user..."
${ADDUSER} -c "Jitterbug Administrator" -g ${JB_GROUP} \
-b ${PKG_PREFIX} -u ${JB_USERID} ${JB_USER}
echo "Done."
fi
exit 0