Skip to content

Instantly share code, notes, and snippets.

@MaPePeR
Created October 10, 2017 08:26
Show Gist options
  • Save MaPePeR/9adb8bb2cff1a50ec3bf13d0542a8992 to your computer and use it in GitHub Desktop.
Save MaPePeR/9adb8bb2cff1a50ec3bf13d0542a8992 to your computer and use it in GitHub Desktop.
Generate a wget+lpadmin script that installs all printers from a cups server as local printers. Keeping Description and Location. Downloads a lot of .ppd Files that might need cleanup. Might not work with other versions of cups.
wget -O- http://$1/printers/ | sed -E 's@<TR><TD><A HREF="/printers/([[:alnum:]]+)">\1</A></TD><TD>([^<]+)</TD><TD>([^<]+)</TD>.+$@echo Installing printer "\1"\nwget http://'$1'/printers/\1.ppd\nlpadmin -p \1 -E -v ipp://'$1'/printers/\1 -D "\2" -L "\3" -P \1.ppd@;tx;d;:x'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment