--- cups-pdf.postinst~ 2011-09-13 09:50:15.000000000 +0200 +++ cups-pdf.postinst 2011-09-13 10:03:41.000000000 +0200 @@ -22,6 +22,22 @@ then invoke-rc.d cups force-reload || invoke-rc.d cups start || true fi + # Wait until CUPS gets ready ... + if lpstat -r 2> /dev/null | grep -q not; then + /bin/echo -en Waiting for CUPS to get ready + t=0 + while lpstat -r 2> /dev/null | grep -q not; do + t=$(($t + 1)) + if [ $t = 10 ]; then + echo + echo 'CUPS is not running!' + break + fi + sleep 1 + /bin/echo -en "." + done + echo + 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:/')" ] then