forked from UoE-macOS/jss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoreconfig-xerox-features-plugin.sh
36 lines (31 loc) · 1.33 KB
/
coreconfig-xerox-features-plugin.sh
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
#!/bin/bash
# Get timestamp
TIMESTAMP=`date "+%Y-%m-%d %H:%M:%S"`
# Sleep for 60s to make sure update has completed
sleep 60s
# Check to make sure the replacement plugin exists
if [ ! -d /usr/local/jamf/XeroxFeatures/XeroxFeatures.plugin ]; then
echo "$TIMESTAMP XeroxFeatures.plugin version 3.52.0 not found in /usr/local/jamf/XeroxFeatures"
# Run custom trigger to re-install Xerox plugin fix
echo "$TIMESTAMP Running custom trigger for policy.."
/usr/local/jamf/bin/jamf policy -event xeroxPlugin
exit 0;
fi
# Get current version of plugin
CURRENT_VERSION=`defaults read /Library/Printers/Xerox/PDEs/XeroxFeatures.plugin/Contents/Info CFBundleShortVersionString`
# If current version is the version we want then quit script
if [ $CURRENT_VERSION = "3.52.0" ]; then
echo "$TIMESTAMP Current version is fine, no need to change. Quitting script…"
exit 0;
# Else, remove current plugin and replace with 3.52.0
else
# Remove current plugin
echo "$TIMESTAMP Current version is $CURRENT_VERSION. Removing…."
rm -dfr /Library/Printers/Xerox/PDEs/XeroxFeatures.plugin
# Replace plugin with the version we want
echo "$TIMESTAMP Replacing version $CURRENT_VERSION with 3.52.0…"
ditto -v "/usr/local/jamf/XeroxFeatures/XeroxFeatures.plugin" "/Library/Printers/Xerox/PDEs/XeroxFeatures.plugin"
# Echo completion
echo "$TIMESTAMP Done!"
fi
exit 0;