122 lines
2.6 KiB
Text
122 lines
2.6 KiB
Text
#! /bin/sh
|
|
#
|
|
# $NetBSD: INSTALL,v 1.1 2001/10/31 23:27:35 zuntum Exp $
|
|
|
|
PKGNAME=$1
|
|
STAGE=$2
|
|
|
|
USER="@CUPS_USER@"
|
|
GROUP="@CUPS_GROUP@"
|
|
|
|
ADDUSER="@ADDUSER@"
|
|
ADDGROUP="@ADDGROUP@"
|
|
CAT="@CAT@"
|
|
CHGRP="@CHGRP@"
|
|
CHMOD="@CHMOD@"
|
|
CHOWN="@CHOWN@"
|
|
CP="@CP@"
|
|
ID="@ID@"
|
|
MKDIR="@MKDIR@"
|
|
RM="@RM@"
|
|
TOUCH="@TOUCH@"
|
|
|
|
LOGDIR=/var/log/cups
|
|
REQUESTDIR=/var/spool/cups
|
|
SAMPLECONFDIR=${PKG_PREFIX}/share/examples/cups
|
|
CONFDIR=/etc/cups
|
|
CONFFILES="client.conf cupsd.conf"
|
|
NONCONFFILES="classes.conf mime.convs mime.types printers.conf"
|
|
|
|
case ${STAGE} in
|
|
PRE-INSTALL)
|
|
# Group... the default's shipped with NetBSD
|
|
# We need to check that ${GROUP} exists before adding the user.
|
|
# Do it with chgrp to be able to use NIS.
|
|
#
|
|
${TOUCH} "/tmp/grouptest.$$"
|
|
${CHGRP} ${GROUP} "/tmp/grouptest.$$" >/dev/null 2>&1
|
|
if [ $? -eq 0 ]
|
|
then
|
|
echo "Group '${GROUP}' already exists...proceeding."
|
|
else
|
|
echo "Creating '${GROUP}' group..."
|
|
${ADDGROUP} ${GROUP}
|
|
echo "Done."
|
|
fi
|
|
${RM} -f "/tmp/grouptest.$$"
|
|
|
|
# Use `id' to be able to use NIS.
|
|
#
|
|
${ID} ${USER} 2>/dev/null >/dev/null
|
|
if [ $? -eq 0 ]
|
|
then
|
|
echo "User '${USER}' already exists...proceeding."
|
|
else
|
|
echo "Creating '${USER}' user..."
|
|
${ADDUSER} -c "Common UNIX Printing System user" -g ${GROUP} -s /bin/sh ${USER}
|
|
echo "Done."
|
|
fi
|
|
;;
|
|
|
|
POST-INSTALL)
|
|
${MKDIR} ${CONFDIR}
|
|
${MKDIR} ${CONFDIR}/certs
|
|
${CHMOD} 711 ${CONFDIR}/certs
|
|
${CHOWN} ${USER}:${GROUP} ${CONFDIR}/certs
|
|
${MKDIR} ${CONFDIR}/interfaces
|
|
${MKDIR} ${CONFDIR}/ppd
|
|
${MKDIR} ${LOGDIR}
|
|
${MKDIR} ${REQUESTDIR}
|
|
${CHMOD} 700 ${REQUESTDIR}
|
|
${CHOWN} ${USER}:${GROUP} ${REQUESTDIR}
|
|
${MKDIR} ${REQUESTDIR}/tmp
|
|
${CHMOD} 1700 ${REQUESTDIR}/tmp
|
|
${CHOWN} ${USER}:${GROUP} ${REQUESTDIR}/tmp
|
|
|
|
echo "Installing configuration files:"
|
|
for file in ${CONFFILES} ${NONCONFFILES}
|
|
do
|
|
FILE=${CONFDIR}/${file}
|
|
SAMPLEFILE=${SAMPLECONFDIR}/${file}
|
|
if [ -f ${FILE} ]
|
|
then
|
|
echo " ${FILE} already exists"
|
|
else
|
|
echo " ${FILE}"
|
|
${CP} ${SAMPLEFILE} ${FILE}
|
|
${CHMOD} 644 ${FILE}
|
|
fi
|
|
done
|
|
${CAT} << EOF
|
|
|
|
===========================================================================
|
|
Some files you might need to customize include the following:
|
|
|
|
EOF
|
|
for file in ${CONFFILES}
|
|
do
|
|
FILE=${CONFDIR}/${file}
|
|
echo " ${FILE}"
|
|
done
|
|
if [ -f ${SAMPLECONFDIR}/cups.pam ]
|
|
then
|
|
${CAT} << EOF
|
|
|
|
To authenticate for CUPS using PAM, add the contents of the file:
|
|
|
|
${SAMPLECONFDIR}/cups.pam
|
|
|
|
to your PAM configuration file.
|
|
EOF
|
|
fi
|
|
${CAT} << EOF
|
|
===========================================================================
|
|
EOF
|
|
;;
|
|
|
|
*)
|
|
echo "Unexpected argument: ${STAGE}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
exit 0
|