X-Git-Url: https://git.slaskete.net/einar-bin/blobdiff_plain/6b74906b168af18ab388bca6a5da3039912dc3e6..aab3dc85472e1d7cb543095da12d0f52b584f275:/addfollowmeprint.sh?ds=sidebyside diff --git a/addfollowmeprint.sh b/addfollowmeprint.sh index 75c7215..53937aa 100755 --- a/addfollowmeprint.sh +++ b/addfollowmeprint.sh @@ -83,12 +83,12 @@ if [ ${UID} -eq 0 ]; then printerror "Please run this script as your normal user, we will prompt you for your sudo password when needed. Or you can use the --plaintext option" exit 1 fi -fi - -echo "Please provide sudo password, as some parts of this script requires it" -if ! sudo true; then - printerror "Sorry, this script requires working sudo privileges to function" - exit 1 +else + echo "Please provide sudo password, as some parts of this script requires it" + if ! sudo true; then + printerror "Sorry, this script requires working sudo privileges to function" + exit 1 + fi fi # Test for supported OS @@ -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 @@ -169,7 +169,7 @@ if [ "${Uname}" = "linux" ]; then if ! sudo rpm -q foomatic-db-ppds 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 @@ -181,10 +181,16 @@ if [ "${Uname}" = "linux" ]; then 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-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 +205,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 @@ -264,7 +270,7 @@ sudo lpadmin -x ${QueueName} > /dev/null 2>&1 # The Linux way if [ "${Uname}" = "linux" ]; then if [ "${Plaintext}" = "YES" ]; then - PrinterShare="smb://${Username}:${Password}@${Workgroup}/${PrintServer}/${PrintFile}" + PrinterShare="smb://${Workgroup}/${Username}:${Password}@${PrintServer}/${PrintFile}" AuthInfo="none" echo -e "\nNOTE: Your credentials will be stored in plaintext in /etc/cups/printers.conf.\nThis is usually only necessary on headless systems or on systems that don't run a dbus-daemon and/or a keyring that can provide the org.freedesktop.secrets service.\nNeedless to say, this is not a good idea on multi-user systems.\n" else @@ -331,4 +337,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 \ No newline at end of file