This file is indexed.

postinst is in printer-driver-cups-pdf 3.0.1-5.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/sh
# [postinst] for cups-pdf
#
# COPYRIGHT
# © 2003-2015 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
	configure)
		# Remove lint from possible upgrades.
		rm -rf /var/spool/cups-pdf/SPOOL
		# Sanitize ownerships and permissions.
		chmod 0700 /usr/lib/cups/backend/cups-pdf
		if ! [ -f /var/log/cups/cups-pdf_log ]
		then
                        touch /var/log/cups/cups-pdf_log
		fi
		chown root:lpadmin /var/log/cups/*
		chmod 0640 /var/log/cups/cups-pdf_log*
		chown root:lpadmin /var/spool/cups-pdf/ANONYMOUS
		chmod 1777 /var/spool/cups-pdf/ANONYMOUS
		# 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
		# Create a PDF queue if we have none yet (but NOT inside chroots; see Debian bugs #539156,#614713)
		if [ -z "$(LC_ALL=C lpstat -h localhost -v 2>/dev/null | grep 'cups-pdf:/')" ] && [ -d /run/cups/certs ]
		then
			# 1) Find a name for the PDF queue.
			queue=PDF
			number=0
			while $(LC_ALL=C lpstat -h localhost -v 2>/dev/null | cut -d ':' -f 1 | cut -d ' ' -f 3 | grep -q ^$queue\$)
			do
				number=$(($number + 1))
				queue="PDF$number"
			done
			# 2) Find the default paper size.
			size="$(LC_ALL=C paperconf 2>/dev/null)" || size=a4
			# 3) Create the queue.
			echo | lpadmin -h localhost -p $queue -v cups-pdf:/ -m lsb/usr/cups-pdf/CUPS-PDF_opt.ppd -o pdftops-renderer-default=pdftocairo -o printer-is-shared=no -o PageSize=$size 2>/dev/null || :
			# 4) Enable the queue.
			echo | cupsenable -h localhost $queue 2>/dev/null || :
			echo | cupsaccept -h localhost $queue 2>/dev/null || :
			# 5) Set the PDF queue as default if there is no default printer yet.
			if [ -z "$(LC_ALL=C lpstat -h localhost -d 2>/dev/null | grep 'system default destination:')" ]
			then
				echo | lpadmin -h localhost -d $queue 2>/dev/null || :
			fi
		else
			echo "Skipped automated creation of the PDF queue."
		fi
		;;
	abort-upgrade|abort-remove|abort-deconfigure)
		;;
	*)
		echo "postinst called with unknown argument \`$1'" >&2
		exit 1
		;;
esac

exit 0