51 lines
1.4 KiB
Text
51 lines
1.4 KiB
Text
#!/bin/sh
|
|
#
|
|
# $NetBSD: INSTALL,v 1.1 2001/11/01 01:00:27 zuntum Exp $
|
|
|
|
PKGNAME=$1
|
|
STAGE=$2
|
|
|
|
HOME=@HOME@
|
|
MAJORDOMO_USER=@MAJORDOMO_USER@
|
|
MAJORDOMO_GROUP=@MAJORDOMO_GROUP@
|
|
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 ${MAJORDOMO_GROUP} exists before adding the user.
|
|
#
|
|
${TOUCH} "/tmp/grouptestmajordomo.$$"
|
|
${CHGRP} ${MAJORDOMO_GROUP} "/tmp/grouptestmajordomo.$$" >/dev/null 2>&1
|
|
if [ $? -eq 0 ]; then
|
|
echo "Group '${MAJORDOMO_GROUP}' already exists...proceeding."
|
|
else
|
|
echo "Creating '${MAJORDOMO_GROUP}' group..."
|
|
${ADDGROUP} ${MAJORDOMO_GROUP}
|
|
echo "Done."
|
|
fi
|
|
${RM} -f "/tmp/grouptestmajordomo.$$"
|
|
|
|
${ID} ${MAJORDOMO_USER} >/dev/null 2>&1
|
|
if [ $? -eq 0 ]; then
|
|
echo "User '${MAJORDOMO_USER}' already exists...proceeding."
|
|
else
|
|
echo "Creating '${MAJORDOMO_USER}' user..."
|
|
${ADDUSER} -c "Majordomo User" -g ${MAJORDOMO_GROUP} \
|
|
-b ${HOME} ${MAJORDOMO_USER}
|
|
echo "Done."
|
|
fi
|
|
|
|
# Home... in case the login exists but not the home directory
|
|
#
|
|
install -d -m 775 -o ${MAJORDOMO_USER} -g ${MAJORDOMO_GROUP} ${HOME}/${MAJORDOMO_USER}
|
|
install -d -m 775 -o ${MAJORDOMO_USER} -g ${MAJORDOMO_GROUP} ${HOME}/${MAJORDOMO_USER}/archives
|
|
install -d -m 775 -o ${MAJORDOMO_USER} -g ${MAJORDOMO_GROUP} ${HOME}/${MAJORDOMO_USER}/digests
|
|
install -d -m 775 -o ${MAJORDOMO_USER} -g ${MAJORDOMO_GROUP} ${HOME}/${MAJORDOMO_USER}/lists
|