File: printer-driver-cups-pdf.postrm

package info (click to toggle)
cups-pdf 2.6.1-15
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 412 kB
  • ctags: 91
  • sloc: ansic: 872; perl: 274; sh: 203; makefile: 13; python: 11
file content (58 lines) | stat: -rw-r--r-- 1,671 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh
# [postrm] for cups-pdf
#
# COPYRIGHT
# © 2003-2011 Martin-Éric Racine <martin-eric.racine@iki.fi>
# © 2009,2011 Till Kamppeter <till.kamppeter@gmail.com>
#
# LICENSE
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License or (at
# your option) any later version.
#
set -e
case "$1" in
	purge|abort-install)
		if [ -f /var/log/cups/cups-pdf_log ]
		then
                        rm /var/log/cups/cups-pdf_log*
		fi
		if [ -d /var/spool/cups-pdf ]
		then
			rm -rf /var/spool/cups-pdf
		fi
		# Ensure that CUPS is running before we manipulate its queues.
		if [ -f /etc/init.d/cups ]
		then
			invoke-rc.d cups force-reload || invoke-rc.d cups start || :
		fi
		# Wait until CUPS has reloaded its configuration.
		if lpstat -h localhost -r 2>/dev/null | grep -q not; then
			t=0
			while lpstat -h localhost -r 2>/dev/null | grep -q not; do
			        t=$(($t + 1))
				if [ $t = 10 ]; then
				        echo "CUPS failed to reload its configuration!"
					break
				fi
				sleep 1
			done
		fi
		# Purge all PDF queues and disable them.
		for queue in $(LC_ALL=C lpstat -h localhost -v 2>/dev/null | grep 'cups-pdf:/' | cut -d ':' -f 1 | cut -d ' ' -f 3)
			do
				echo | cupsreject -h localhost $queue 2>/dev/null || :
				echo | cupsdisable -h localhost $queue 2>/dev/null || :
				echo | lpadmin -h localhost -x $queue 2>/dev/null || :
			done
		;;
	abort-upgrade|upgrade|failed-upgrade|remove|disappear)
		;;
	*)
		echo "postrm called with unknown argument \`$1'" >&2
		exit 1
		;;
esac
#DEBHELPER#
exit 0