diff -u cups-pdf-2.5.0/debian/postinst cups-pdf-2.5.0/debian/postinst --- cups-pdf-2.5.0/debian/postinst +++ cups-pdf-2.5.0/debian/postinst @@ -20,7 +20,19 @@ # We need CUPS to reload its configuration before the backend is available. if [ -f /etc/init.d/cups ] then - invoke-rc.d cups force-reload || invoke-rc.d cups start || true + 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. if [ -z "$(LC_ALL=C lpstat -h localhost -v 2>/dev/null | grep 'cups-pdf:/')" ] @@ -37,21 +49,22 @@ 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.ppd -o printer-is-shared=no -o PageSize=$size 2>/dev/null || : - # 4) Set the PDF queue as default if there is no default printer yet. + # 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 fi - ;; - + ;; abort-upgrade|abort-remove|abort-deconfigure) - ;; - + ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 - ;; + ;; esac #DEBHELPER# diff -u cups-pdf-2.5.0/debian/changelog cups-pdf-2.5.0/debian/changelog --- cups-pdf-2.5.0/debian/changelog +++ cups-pdf-2.5.0/debian/changelog @@ -1,6 +1,19 @@ +cups-pdf (2.5.0-17squeeze2) stable-security; urgency=low + + * Hand-picked fixes from 2.5.1-5 and 2.5.1-7 packaging: + + Modified the force-reload loop in [postinst|prerm|postrm] to end with ||: + rather than with ||true for consistency with other maintainer commands. + + Added a wait loop in [postinst|prerm|postrm] to ensure that CUPS reloaded. + + Added 'cupsenable' and 'cupsaccept' steps in [postinst] to ensure that + the PDF queue is up and running before we can manipulate it. (LP: #805947) + + Added 'cupsdisable' and 'cupsreject' steps in [prerm|postrm] to match. + * Thanks to Till Kamppeter for all the above suggestions. + + -- Martin-Éric Racine Sat, 24 Sep 2011 21:37:26 +0300 + cups-pdf (2.5.0-17squeeze1) stable-security; urgency=low - * Hand-picked fixes from 2.5.1 packaging: + * Hand-picked fixes from 2.5.1-3 packaging: + Remove the superfluous -E option to the queue creation loop in [postinst]. This was unnecessary to access localhost plus it sometimes makes automated installs fail. (Closes: #614713,#539156). diff -u cups-pdf-2.5.0/debian/prerm cups-pdf-2.5.0/debian/prerm --- cups-pdf-2.5.0/debian/prerm +++ cups-pdf-2.5.0/debian/prerm @@ -8,10 +8,25 @@ # We need CUPS to be running to be able to remove the PDF queue. if [ -f /etc/init.d/cups ] then - invoke-rc.d cups force-reload || invoke-rc.d cups start || true + 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 remaining PDF queues. 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 ;; diff -u cups-pdf-2.5.0/debian/postrm cups-pdf-2.5.0/debian/postrm --- cups-pdf-2.5.0/debian/postrm +++ cups-pdf-2.5.0/debian/postrm @@ -16,11 +16,25 @@ # We need CUPS to be running to be able to remove the PDF queue. if [ -f /etc/init.d/cups ] then - invoke-rc.d cups force-reload || invoke-rc.d cups start || true + 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 remaining PDF queues. 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 # We need CUPS to reload its configuration to make the backend unavailable.