source: trunk/debathena/config/cluster-cups-config/debian/prerm @ 24838

Revision 24838, 1.6 KB checked in by geofft, 14 years ago (diff)
In cluster-cups-config: * Also do something useful with the printers.conf and classes.conf files, and bail in the postinst/prerm if we can't stop CUPS while attempting to do said useful thing. In cupsys-config: other stuff while cups is down (or if we're not restarting it)
Line 
1#!/bin/sh
2# prerm script for #PACKAGE#
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# summary of how this script can be called:
9#        * <prerm> `remove'
10#        * <old-prerm> `upgrade' <new-version>
11#        * <new-prerm> `failed-upgrade' <old-version>
12#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
13#        * <deconfigured's-prerm> `deconfigure' `in-favour'
14#          <package-being-installed> <version> `removing'
15#          <conflicting-package> <version>
16# for details, see http://www.debian.org/doc/debian-policy/ or
17# the debian-policy package
18
19
20# dh_installdeb will replace this with shell code automatically
21# generated by other debhelper scripts.
22
23#DEBHELPER#
24
25. /usr/lib/debathena-cupsys-config/restart-cups.sh
26
27restart_cups_extra ()
28{
29    # CUPS needs to not be running while we do this.
30    if [ "$1" -gt 0 ]; then
31        echo "CUPS is running and cannot be stopped automatically!" >&2
32        echo "Please shut down CUPS and retry deconfiguring this package." >&2
33        return 1
34    fi
35
36    for file in printers.conf printers.conf.O classes.conf classes.conf.O; do
37        if [ -e /etc/cups/"$file" ]; then
38            rm /etc/cups/"$file"
39        fi
40    done
41    if [ -d /etc/cups/debathena-cluster-cups-config-saved ]; then
42        mv /etc/cups/debathena-cluster-cups-config-saved/* /etc/cups
43    fi
44}
45
46. /usr/lib/debathena-cupsys-config/restart-cups.sh
47
48case "$1" in
49    remove|deconfigure)
50        restart_cups
51    ;;
52
53    upgrade)
54    ;;
55
56    failed-upgrade)
57    ;;
58
59    *)
60        echo "prerm called with unknown argument \`$1'" >&2
61        exit 1
62    ;;
63esac
64
65exit 0
66
67
Note: See TracBrowser for help on using the repository browser.