core/cups/cups.install

46 lines
1.6 KiB
Plaintext
Raw Normal View History

2011-11-02 02:59:33 +08:00
add_daemon() {
checkdmn=$(grep '^DAEMONS' /etc/rc.conf | grep cups)
if [ -z "${checkdmn}" ]; then
2011-11-02 02:59:33 +08:00
sed -i '/^DAEMONS/{s/)$/ cups)/}' /etc/rc.conf
fi
2011-11-02 02:59:33 +08:00
}
2010-03-14 23:48:48 +08:00
post_install() {
2011-11-02 02:59:33 +08:00
xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
echo ">> If you use an HTTPS connection to CUPS, the first time you access"
echo ">> the interface it may take a very long time before the site comes up."
echo ">> This is because the first request triggers the generation of the CUPS"
echo ">> SSL certificates which can be a very time-consuming job."
2011-11-02 02:59:33 +08:00
add_daemon
/etc/rc.d/cups restart
2010-03-14 23:48:48 +08:00
}
post_upgrade() {
2011-11-02 02:59:33 +08:00
xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
# If the "lp" user group is still present, and the user has not changed the cupsd.conf
# from the old default "SystemGroup sys root" setting, let's replace that line, so that
# it will also allow for the "lp" user group to administrate CUPS.
# Without this, non-root users will see the Printers KCM silently hang (the CUPS server
# will deny access).
local cupsd=etc/cups/cupsd.conf
if ( getent group lp && grep '^SystemGroup sys root$' "${cupsd}") &>/dev/null; then
echo "[NOTICE] The CUPS configuration is being automatically tweaked to allow all users belonging to the \"lp\" group to administrate the server."
sed -i 's/^SystemGroup sys root$/SystemGroup sys root lp/g' "${cupsd}"
fi
2011-11-02 02:59:33 +08:00
add_daemon
/etc/rc.d/cups restart
}
pre_remove() {
/etc/rc.d/cups stop
2010-03-14 23:48:48 +08:00
}
post_remove() {
2011-11-02 02:59:33 +08:00
xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
sed -i '/^DAEMONS/{s/ cups)$/)/}' /etc/rc.conf
2010-03-14 23:48:48 +08:00
}