+ sudo cupsenable "${QueueName}"
+ sudo cupsaccept "${QueueName}"
+
+ # Add credentials to the keychain if they are missing
+ # Shamelessly stolen^W^WBorrowed from https://github.com/Orakeltjenesten/scripts/blob/33abfb353524f449f0bbdee27adb2f1f0a9756a2/print/ntnuprint-mac.sh
+ # TODO: Since we should have a known-good username and password at this stage it's unwise to re-use the existing credentials, can we simply drop the test?
+ if ! security find-internet-password -s ${PrintServer} >/dev/null 2>&1; then
+ security -v add-internet-password -a "${Workgroup}\\${Username}" -s ${PrintServer} \
+ -w "${Password}" -D "Network Password" -r "smb " -l "${QueueName}" \
+ -T /System/Library/CoreServices/NetAuthAgent.app -T 'group://NetAuth' \
+ -T /System/Library/CoreServices/NetAuthAgent.app/Contents/MacOS/NetAuthSysAgent >/dev/null 2>&1
+ fi