openbsd-ports/print/cups/pkg/cupsd.rc

35 lines
898 B
Bash
Executable File

#!/bin/ksh
daemon="${TRUEPREFIX}/sbin/cupsd"
. /etc/rc.d/rc.subr
pexp="${daemon} .*"
rc_pre() {
# XXX cups-driverd(8) can crash when setting up a printer driver
rm -f /var/cache/cups/*
# rc_exec is needed because:
# - ${TRUEPREFIX}/sbin/cupsd is only executable by root
# - if openfiles limits are bumped and cupsd(8) runs in debug mode to
# prevent MaxClients warnings in logs
rc_exec "${daemon} ${daemon_flags} -t" || return 1
# no existing printcap means we're not running lpd(8) so link cups'
# printcap so base lp commands can find and use cups printers
if [[ ! -e /etc/printcap ]]; then
ln -s ${SYSCONFDIR}/cups/printcap /etc/printcap
# please check_mtree() in security(8); /etc/mtree/special
chmod -h 0644 /etc/printcap
fi
}
rc_post() {
if [[ -h /etc/printcap ]]; then
rm /etc/printcap
fi
}
rc_cmd $1