c1f3074d18
While here, create cups's printcap under /etc/cups/ because we are running unpriviledged so we cannot touch /etc/printcap. Tweak rc script accordingly.
70 lines
1.5 KiB
Bash
Executable File
70 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $OpenBSD: cupsd.rc,v 1.11 2012/02/16 22:12:08 ajacoutot Exp $
|
|
|
|
daemon="${TRUEPREFIX}/sbin/cupsd"
|
|
|
|
. /etc/rc.d/rc.subr
|
|
|
|
pexp="${daemon}"
|
|
|
|
_lpfiles="/usr/bin/lpq /usr/bin/lpr /usr/bin/lprm /usr/sbin/lpc \
|
|
/usr/sbin/lpd /usr/share/man/cat1/lpq.0 /usr/share/man/cat1/lpr.0 \
|
|
/usr/share/man/cat1/lprm.0 /usr/share/man/cat8/lpc.0 \
|
|
/usr/share/man/cat8/lpd.0"
|
|
|
|
rc_pre() {
|
|
${daemon} -t || return 1
|
|
[ -e /dev/ulpt0 ] && chown _cups /dev/ulpt[0-1]
|
|
[ -e /dev/lpt0 ] && chown _cups /dev/lp[a,t][0-2]
|
|
|
|
if [ -e /usr/sbin/lpd.pre-cups -a ! -f /usr/sbin/lpd -a -L /usr/sbin/lpc ]; then
|
|
return
|
|
elif [ ! -e /usr/sbin/lpd ]; then
|
|
return
|
|
else
|
|
for i in ${_lpfiles}; do
|
|
if [ -f $i -a ! -L $i ]; then
|
|
mv -f $i $i.pre-cups
|
|
fi
|
|
done
|
|
fi
|
|
if [ -e /etc/printcap -a ! -e /etc/printcap.pre-cups ]; then
|
|
mv /etc/printcap /etc/printcap.pre-cups
|
|
ln -s ${SYSCONFDIR}/cups/printcap /etc/printcap
|
|
fi
|
|
for i in lpq lpr lprm; do
|
|
rm -f /usr/bin/$i
|
|
ln -s ${TRUEPREFIX}/bin/$i /usr/bin/$i
|
|
done
|
|
rm -f /usr/sbin/lpc
|
|
ln -s ${TRUEPREFIX}/sbin/lpc /usr/sbin/lpc
|
|
}
|
|
|
|
rc_post() {
|
|
if [ ! -L /usr/sbin/lpc ]; then
|
|
return
|
|
else
|
|
for i in lpq lpr lprm; do
|
|
rm -f /usr/bin/$i
|
|
done
|
|
|
|
rm -f /usr/sbin/lpc
|
|
|
|
if [ ! -e /usr/sbin/lpd.pre-cups ]; then
|
|
return
|
|
else
|
|
for i in ${_lpfiles} /etc/printcap; do
|
|
if [ -e $i.pre-cups ]; then
|
|
mv -f $i.pre-cups $i
|
|
fi
|
|
done
|
|
fi
|
|
fi
|
|
|
|
[ -e /dev/lpt0 ] && chown root /dev/lp[a,t][0-2]
|
|
[ -e /dev/ulpt0 ] && chown root /dev/ulpt[0-1]
|
|
}
|
|
|
|
rc_cmd $1
|