Check whether there is already a CUPS-PDF queue with "LC_ALL=C lpstat -v | grep 'cups-pdf:/'". If so, assign the name of the first queue found to $queue and skip the next paragraph.
Assign "PDF" to the variable $queue, then start a "while" loop checking "LC_ALL=C lpstat -v | cut -d ':' -f 1 | cut -d ' ' -f 3 | grep ^$queue\$" and exit the "while" loop if it fails. In the while loop asign a new name to $queue: PDF, PDF1, PDF2, ... Then create the queue with queue name $queue.
Then check with "LC_ALL=C lpstat -d | grep 'system default destination:'" whether there is already a default printer. If not, set the PDF printer as default with "lpadmin -d $queue".
Steps for Post-install:
Check whether there is already a CUPS-PDF queue with "LC_ALL=C lpstat -v | grep 'cups-pdf:/'". If so, assign the name of the first queue found to $queue and skip the next paragraph.
Assign "PDF" to the variable $queue, then start a "while" loop checking "LC_ALL=C lpstat -v | cut -d ':' -f 1 | cut -d ' ' -f 3 | grep ^$queue\$" and exit the "while" loop if it fails. In the while loop asign a new name to $queue: PDF, PDF1, PDF2, ... Then create the queue with queue name $queue.
Then check with "LC_ALL=C lpstat -d | grep 'system default destination:'" whether there is already a default printer. If not, set the PDF printer as default with "lpadmin -d $queue".