2 # This script installs the SafeCom pullprint print queue
3 # for Høgskolen i Gjøvik on Linux and Mac systems.
4 # Written by einarh@hig.no
5 # I consider this script public domain
7 # Test for system variant
9 if [ "${OS}" != "Darwin" ] && [ "${OS}" != "Linux" ]; then
10 echo "I don't think I can run on "${OS}", but if you insist, please edit me and remove the test." 1>&2
15 if [ $
(id
-u) -ne 0 ]; then
16 echo "This script must be run as root. Please use sudo or log in as root" 1>&2
21 command -v lpadmin
>/dev
/null
2>&1
23 echo "You must have CUPS installed to add printers. Please install CUPS." 1>&2
27 # Test for smbclient if on Linux
28 if [ "${OS}" = "Linux" ]; then
29 command -v smbclient
>/dev
/null
2>&1
31 echo "You must have smbclient installed to add printers. Please install smbclient." 1>&2
36 echo "This script will add a new printer called Pullprint, connecting to
37 the print server safecom2.hig.no using your normal user name and
38 password from HiG. Do not use on multi user systems!"
50 # Test for valid username and password if on Linux
51 if [ "${OS}" = "Linux" ]; then
52 smbclient
-U HIG
/${USERNAME}%${PASSWORD} -L //hig.no
> /dev
/null
2>&1
54 echo "User name or password incorrect, or no contact with HiG servers." 1>&2
62 if [ "${OS}" = "Linux" ]; then
63 lpadmin
-p Pullprint \
64 -D "SafeCom Pullprint ved HiG" \
65 -v "smb://hig%5C${USERNAME}:${PASSWORD}@safecom2.hig.no/PullPrint" \
66 -m "drv:///sample.drv/generic.ppd" \
71 if [ "${OS}" = "Darwin" ]; then
72 lpadmin
-p Pullprint \
73 -D "SafeCom Pullprint ved HiG" \
74 -v "smb://HIG;${USERNAME}:${PASSWORD}@safecom2.hig.no/PullPrint" \
75 -m "drv:///sample.drv/generic.ppd" \
80 echo "Could not connect to printer share. See above error for details." 1>&2
84 # Set correct paper size and enable the duplexer option
85 lpadmin
-p Pullprint
-o PageSize
=A4
-o Option1
=True
88 echo "Could not set default options. See above error for details." 1>&2
96 echo "Could not set Pullprint as default printer. See above error for details." 1>&2
100 echo "Printer successfully installed."