X-Git-Url: https://git.slaskete.net/einar-bin/blobdiff_plain/d0516fbae9de87ae04446ad16fd342c7f0cec28d..407e7e5c5d504db44d89cb6d5d3a92d693009a8c:/addfollowmeprint.sh diff --git a/addfollowmeprint.sh b/addfollowmeprint.sh index 035767d..f422c52 100755 --- a/addfollowmeprint.sh +++ b/addfollowmeprint.sh @@ -1,5 +1,5 @@ #!/bin/bash -# This script installs the FollowMe print queue at NTNU on Linux (and possibly Mac) systems. +# This script installs the FollowMe print queue at NTNU on Linux and possibly Mac systems. # The targeted and tested distros are: Debian, Ubuntu (and derivates), Fedora, CentOS, OpenSUSE and Mint # Copyright © 2017-2019 einar.haraldseid@ntnu.no @@ -8,7 +8,7 @@ function usage { echo "Usage: ./$(basename "${0}") [OPTIONS]" echo "Options:" echo " -m, --model {ricoh|generic} Printer model to install (default: generic)" - echo " -d, --driver {pcl,postscript} Printer driver to use (default: postscript)" + echo " -d, --driver {pcl|postscript} Printer driver to use (default: postscript)" echo " -f, --force Force running script as if on Linux systems" echo " -p, --plaintext Store credentials as plaintext in /etc/cups/printers.conf (Linux only)" echo " -h, --help Display this help text" @@ -139,7 +139,7 @@ if [ "${Uname}" = "linux" ]; then if ! sudo rpm -q OpenPrintingPPDs-postscript >/dev/null 2>&1; then printerror "You don't seem to have the correct printer drivers installed, please run:" printerror " sudo zypper install OpenPrintingPPDs-postscript" - printerror "first, or use the generic driver instead." + printerror "first, or use the generic model instead." exit 1 else DriverPath="OpenPrintingPPDs/postscript/Ricoh-MP_C6003.Postscript-Ricoh.ppd.gz" @@ -151,7 +151,7 @@ if [ "${Uname}" = "linux" ]; then if ! sudo rpm -q OpenPrintingPPDs-ghostscript >/dev/null 2>&1; then printerror "You don't seem to have the correct printer drivers installed, please run:" printerror " sudo zypper install OpenPrintingPPDs-ghostscript" - printerror "first, or use the generic driver instead." + printerror "first, or use the generic model instead." exit 1 else if [ "${Model}" = "ricoh" ]; then @@ -166,10 +166,10 @@ if [ "${Uname}" = "linux" ]; then if [ "${Model}" = "ricoh" ]; then # This should match Fedora and other modern rpm based systems that have dnf as the primary package manager if command -v dnf >/dev/null 2>&1; then - if ! sudo rpm -q foomatic-db-ppds 2>&1; then + if ! sudo rpm -q foomatic-db-ppds > /dev/null 2>&1; then printerror "You don't seem to have the correct printer drivers installed, please run:" printerror " sudo dnf install foomatic-db-ppds" - printerror "first, or use the generic driver instead." + printerror "first, or use the generic model instead." exit 1 else if [ "${Driver}" = "postscript" ]; then @@ -178,13 +178,18 @@ if [ "${Uname}" = "linux" ]; then DriverPath="foomatic-db-ppds/Ricoh/PXL/Ricoh-MP_C6003_PXL.ppd.gz" fi fi - fi # This should match CentOS, RHEL and other RHEL based distros that have yum as the primary package manager - if command -v yum >/dev/null 2>&1; then - if ! sudo rpm -q foomatic-db-ppds >/dev/null 2>&1; then + elif command -v yum >/dev/null 2>&1; then + if ! sudo rpm -q foomatic-filters > /dev/null 2>&1; then + printerror "You don't seem to have the foomatic-filters package installed, please run:" + printerror " sudo yum install foomatic-filters" + printerror "first, or use the generic model instead." + exit 1 + fi + if ! sudo rpm -q foomatic-db-ppds > /dev/null 2>&1; then printerror "You don't seem to have the correct printer drivers installed, please run:" printerror " sudo yum install foomatic-db-ppds" - printerror "first, or use the generic driver instead." + printerror "first, or use the generic model instead." exit 1 else if [ "${Driver}" = "postscript" ]; then @@ -199,7 +204,7 @@ if [ "${Uname}" = "linux" ]; then if ! sudo dpkg -s openprinting-ppds > /dev/null 2>&1; then printerror "You must have the correct printer drivers installed, please run:" printerror " sudo apt-get install openprinting-ppds" - printerror "first, or use the generic driver instead." + printerror "first, or use the generic model instead." exit 1 else if [ "${Driver}" = "postscript" ]; then @@ -331,4 +336,8 @@ if ! sudo lpadmin -d ${QueueName}; then exit 1 fi -echo "Printer successfully installed. You may need to restart cups for the changes to take effect." +echo "Printer successfully installed." + +if [ "${Uname}" = "linux" ] && [ "${Plaintext}" != "YES" ]; then + echo -e "\nPlease note: due to the way credentials are stored and accessed on Linux, some print operations will still halt for credentials, notably the \"Print test page\" function. In those cases, supply your normal NTNU username and password." +fi