echo ""
# Some further tests for Linux systems
-# TODO: Add similar tests for macOS
if [ "${Uname}" = "linux" ]; then
echo -e "\nNOTE: Your credentials will be stored in plaintext in /etc/cups/printers.conf.\nThis file us usually not readable for normal users, but still:\nDo not use this script on multi user systems!"
# Test for valid username and password if on Linux
fi
fi
+# Similar tests for OSX
+if [ "${Uname}" = "darwin" ]; then
+ smbutil view -A "//${Workgroup};${Username}:${Password}@${PrintServer}" > /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ printerror "User name or password incorrect, or no contact with the print server ${PrintServer}."
+ exit 1
+ fi
+ ShareFound=$(smbutil view "//${Workgroup};${Username}:${Password}@${PrintServer}" 2>/dev/null | grep ${PrintShare} | cut -d " " -f 1)
+ if [ "${ShareFound}" != "${PrintShare}" ]; then
+ printerror "Could not find printer share called ${PrintShare} on the server"
+ printerror "This script must be broken or outdated. Please contact orakel@ntnu.no for further assistance."
+ exit 1
+ fi
+fi
+
# Finally we can add the printer
# The Linux way