Untitled
unknown
plain_text
2 years ago
1.3 kB
80
Indexable
#!/bin/bash mobilityhost=$4 name=$5 location=$6 info=$7 mobilityqueue="ipps://$mobilityhost:9164/printers/$name" # Make sure the print queue isn't already installed. lpstat -p $name &> /dev/null if [ $? == "0" ] then echo "$name already exists, exiting." exit 1 fi # CUPS & PaperCut Mobility Print prefer to use an AirPrint compatible driver. We can use inbuilt MacOS Binaries to build this file: # Make sure the binary exists. if [ -f /System/Library/Printers/Libraries/ipp2ppd ] then # Use ipp2ppd to build the appropriate PPD /System/Library/Printers/Libraries/ipp2ppd $mobilityqueue /tmp/$name.tmp > "/tmp/$name" if [ "$?" -ne "0" ]; then echo "ipp2ppd errored." exit 1 fi else echo "/System/Library/Printers/Libraries/ipp2ppd missing." exit 1 fi # Add the print queue. if [ -f /tmp/$name ] then lpadmin -p "$name" -E -v "$mobilityqueue" -i "/tmp/$name" -L "$location" -D "$info" -o auth-info-required=username,password -o printer-error-policy=retry-job if [ "$?" -ne "0" ]; then echo "lpadmin errored." exit 1 fi else echo "/tmp/$name is missing" exit 1 fi #CleanUp if [ -f /tmp/$name ] then rm /tmp/$name fi if [ -f /tmp/$name.tmp ] then rm /tmp/$name fi
Editor is loading...