blob: 291ed053b80d31afee0f7dfb5eab8f00f1db7b2f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
#! /bin/sh
#
# $NetBSD: INSTALL,v 1.5 2000/12/11 08:42:03 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="classes.conf client.conf cupsd.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
${MKDIR} ${CONFDIR}/interfaces
${MKDIR} ${CONFDIR}/ppd
${MKDIR} ${LOGDIR}
${MKDIR} ${REQUESTDIR}
${CHOWN} ${USER}:${GROUP} ${REQUESTDIR}/tmp
${MKDIR} ${REQUESTDIR}/tmp
${CHMOD} u+rwx,go-rwx,+t ${REQUESTDIR}/tmp
${CHOWN} ${USER}:${GROUP} ${REQUESTDIR}/tmp
echo "Installing configuration files:"
for file in ${CONFFILES}
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
${CAT} << EOF
===========================================================================
EOF
;;
*)
echo "Unexpected argument: ${STAGE}"
exit 1
;;
esac
exit 0
|