#! /bin/sh # # $NetBSD: INSTALL,v 1.8 2000/12/28 02:22:18 jlam 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@" GREP="@GREP@" 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 `finger' to be able to use NIS. # finger ${USER} 2>&1 | ${GREP} -q "no such user" if [ $? -eq 0 ] then echo "Creating '${USER}' user..." ${ADDUSER} -c "CUPS User" -g ${GROUP} -s /bin/sh ${USER} echo "Done." else echo "User '${USER}' already exists...proceeding." fi ;; POST-INSTALL) ${MKDIR} ${CONFDIR} ${MKDIR} ${CONFDIR}/certs ${CHMOD} ugo+x,go-rw ${CONFDIR}/certs ${MKDIR} ${CONFDIR}/interfaces ${MKDIR} ${CONFDIR}/ppd ${MKDIR} ${LOGDIR} ${MKDIR} ${REQUESTDIR} ${CHMOD} u+rwx,go-rwx ${REQUESTDIR} ${CHOWN} ${USER}:${GROUP} ${REQUESTDIR} ${MKDIR} ${REQUESTDIR}/tmp ${CHMOD} u+rwx,go-rwx,+t ${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