-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPrinterLogic_client_install.sh
More file actions
155 lines (117 loc) · 4.45 KB
/
PrinterLogic_client_install.sh
File metadata and controls
155 lines (117 loc) · 4.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/bin/zsh --no-rcs
# Jason Filice
# jfilice@csumb.edu
# Technology Support Services in IT
# California State University, Monterey Bay
# https://csumb.edu/it
# Use as script in Jamf JSS.
# This script requires 2 arguments:
#
# Parameter 4 = HOMEURL
# Your PrinterLogic domain name. e.g. companyname.printercloud.com
#
# Parameter 5 = AUTHCODE
# Authorized Device code that you generate in the Admin console.
#
# ##### Product Documentation #####
#
# https://help.printerlogic.com/saas/1-Printerlogic/Release_Notes/SaaS.htm
#
# https://kb.printerlogic.com/s/article/Script-to-install-upgrade-Mac
# https://help.printerlogic.com/saas/Print/Print_Mgmt/Client_Mgmt/Workstation-Install.htm
# https://help.printerlogic.com/saas/Print/Print_Mgmt/Client_Mgmt/Additional-Client-Options.htm
# https://help.printerlogic.com/saas/Print/Setup/Client-Install.htm
# https://help.printerlogic.com/saas/Print/Setup/Client-Install.htm
# https://help.printerlogic.com/saas/1-Printerlogic/Release_Notes/SaaS.htm
# https://kb.printerlogic.com/s/article/What-Mac-OS-versions-are-supported-by-Printerlogic
# https://kb.printerlogic.com/s/article/How-to-manually-enable-the-Safari-extension-from-a-terminal
# https://kb.printerlogic.com/s/article/How-to-uninstall-Mac-client
# https://kb.printerlogic.com/s/article/Deploy-the-PrinterLogic-Chrome-Extension-via-GPO
# https://kb.printerlogic.com/s/article/How-to-manually-enable-the-Safari-extension-from-a-terminal
# https://kb.printerlogic.com/s/article/How-to-upload-Mac-drivers
# https://kb.printerlogic.com/s/article/How-to-pull-down-and-install-the-Windows-client-using-a-script
# https://kb.printerlogic.com/s/article/CouldnotcommunicatewiththePrinterLogicclientItmaynotbeinstalledorrunning
# https://kb.printerlogic.com/s/article/Unable-to-install-client-Apple-cannot-check-for-malicious-software
#
# Change History:
# 2021/12/15: Creation.
# 2025/02/20: Arm64 download link. Variables
#
SCRIPTNAME=`/usr/bin/basename "$0"`
SCRIPTDIR=`/usr/bin/dirname "$0"`
# Jamf JSS Parameters 1 through 3 are predefined as mount point, computer name, and username
pathToScript=$0
mountPoint=$1
computerName=$2
userName=$3
shift 3
# Shift off the $1 $2 $3 parameters passed by the JSS so that parameter 4 is now $1
# set -x
echo pathToScript=$pathToScript
echo mountPoint=$mountPoint
echo computerName=$computerName
echo userName=$userName
# Example:
# /bin/ls -FlOah "${SCRIPTDIR}"
#
readonly HOMEURL="${1}"
readonly AUTHCODE="${2}"
readonly PKG_EXPECTED_TEAMID='25DQ8HVJ3B'
readonly launchdPlistPath="/Library/LaunchDaemons/com.printerlogic.client.plist"
readonly CPUarch=$(/usr/bin/uname -m)
# Expected results: arm64 | i386 | x86_64
if [[ "${CPUarch}" = "arm64" ]]; then
readonly PKGfile="PrinterInstallerClientSetup_arm64.pkg"
else
readonly PKGfile="PrinterInstallerClientSetup.pkg"
fi
readonly PKG_URL="https://${HOMEURL}/client/setup/${PKGfile}"
if [[ -e /tmp/"${PKGfile}" ]]; then
/bin/rm -fR /tmp/"${PKGfile}"
fi
/usr/bin/curl "${PKG_URL}" --location --silent --show-error --output /tmp/"${PKGfile}"
if [[ -e /tmp/"${PKGfile}" ]]; then
/usr/sbin/pkgutil --check-signature /tmp/"${PKGfile}"
/usr/sbin/installer -pkg /tmp/"${PKGfile}" -target /
else
echo "ERROR: ${PKGfile} not found"
exit 1
fi
if [[ -f /opt/PrinterInstallerClient/VERSION ]]; then
clientVers="$(cat /opt/PrinterInstallerClient/VERSION)"
echo "PrinterLogic client version=${clientVers}"
else
echo "ERROR: PrinterLogic client Not Installed"
exit 1
fi
if [[ -e /opt/PrinterInstallerClient/bin/set_home_url.sh ]]; then
/opt/PrinterInstallerClient/bin/set_home_url.sh https ${HOMEURL}
else
echo "ERROR: /opt/PrinterInstallerClient/bin/set_home_url.sh not found"
exit 1
fi
if [[ -e /opt/PrinterInstallerClient/bin/use_authorization_code.sh ]]; then
/opt/PrinterInstallerClient/bin/use_authorization_code.sh ${AUTHCODE}
else
echo "ERROR: /opt/PrinterInstallerClient/bin/use_authorization_code.sh not found"
exit 1
fi
sleep 5
echo "Safari feature fix..."
if [[ -f "${launchdPlistPath}" ]]; then
/bin/launchctl bootout system "${launchdPlistPath}" 2>&1
fi
sleep 1
if [[ -f "${launchdPlistPath}" ]]; then
/bin/launchctl bootstrap system "${launchdPlistPath}" 2>&1
fi
sleep 1
if [[ "$userName" != "" ]] && [[ -x /opt/PrinterInstallerClient/bin/refresh.sh ]]
then
# As root
/usr/bin/killall -KILL -v PrinterInstallerClient 2>&1
sleep 2
echo "running /opt/PrinterInstallerClient/bin/refresh.sh to restart the Printer Installer Client Menu Bar..."
/opt/PrinterInstallerClient/bin/refresh.sh
fi
exit 0