source: trunk/debathena/config/cluster-cups-config/debian/preinst @ 25012

Revision 25012, 1.6 KB checked in by jdreed, 14 years ago (diff)
In cluster-cups-config: * Stop shipping our own printers.conf and classes.conf; instead use lpadmin and add-athena-printer (Trac: #841) * Fix the broken prerm by cleaning up in the preinst for pre-2.0 packages * No more printername2 queues for legacy LPRng printers
Line 
1#!/bin/sh
2# preinst script for deabthena-cluster-cups-config
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# summary of how this script can be called:
9#        * <new-preinst> `install'
10#        * <new-preinst> `install' <old-version>
11#        * <new-preinst> `upgrade' <old-version>
12#        * <old-preinst> `abort-upgrade' <new-version>
13# for details, see http://www.debian.org/doc/debian-policy/ or
14# the debian-policy package
15
16
17. /usr/lib/debathena-cupsys-config/restart-cups.sh
18
19restart_cups_extra ()
20{
21    # CUPS needs to not be running while we do this.
22    if [ "$1" -gt 0 ]; then
23        echo "CUPS is running and cannot be stopped automatically!" >&2
24        echo "Please shut down CUPS and retry deconfiguring this package." >&2
25        return 1
26    fi
27
28    for file in printers.conf printers.conf.O classes.conf classes.conf.O; do
29        if [ -e /etc/cups/"$file" ]; then
30            rm /etc/cups/"$file"
31        fi
32    done
33
34    if [ -d /etc/cups/debathena-cluster-cups-config-saved ]; then
35        find /etc/cups/debathena-cluster-cups-config-saved -mindepth 1 \
36            -exec mv {} /etc/cups \;
37    fi
38    # And nuke the directory so the old prerm doesn't fail
39    rm -rf  /etc/cups/debathena-cluster-cups-config-saved
40}
41
42
43case "$1" in
44    install|upgrade)
45        # On an upgrade, cleanup after pre-2.0 versions
46        if dpkg --compare-versions "$2" lt-nl 2.0~; then
47            restart_cups
48        fi
49    ;;
50
51    abort-upgrade)
52    ;;
53
54    *)
55        echo "preinst called with unknown argument \`$1'" >&2
56        exit 1
57    ;;
58esac
59
60# dh_installdeb will replace this with shell code automatically
61# generated by other debhelper scripts.
62
63#DEBHELPER#
64
65exit 0
Note: See TracBrowser for help on using the repository browser.