-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsetSUS.sh
More file actions
72 lines (61 loc) · 2.52 KB
/
Copy pathsetSUS.sh
File metadata and controls
72 lines (61 loc) · 2.52 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
#!/bin/sh
#># Purpose: Set the Software Update Server for root and all users to the OS-appropriate catalog
#># Original Author: Jared F. Nichols
#># With additions from Chad Brewer post on JamfNation
#Adapted by Bram Cohen 2/20/13
#Define your Snow Leopard Branch 10.6
SLSUS="http://applesus.domain.com/content/catalogs/others/index-leopard-snowleopard.merged-1.sucatalog"
#Define your Lion Branch 10.7
LSUS="http://servername/content/catalogs/others/index-lion-snowleopard-leopard.merged-1_Prod.sucatalog"
#Define your Mountian Lion Branch 10.8
MLSUS="http://servername/content/catalogs/others/index-mountainlion-lion-snowleopard-leopard.merged-1_Prod.sucatalog"
#Define the Name of your Server for the log output
NAME="SERVERNAME"
#System Variable - Don't Modify
OSversion=`sw_vers | grep ProductVersion`
#Sets System-Level com.apple.SoftwareUpdate.plist
case $OSversion in
*10.6*)
defaults write /var/root/Library/Preferences/com.apple.softwareupdate CatalogURL $SLSUS
defaults write /Library/Preferences/com.apple.softwareupdate CatalogURL $SLSUS
echo "Setting SUS to $NAME Lion Branch for User $d"
;;
*10.7*)
defaults write /var/root/Library/Preferences/com.apple.softwareupdate CatalogURL $LSUS
defaults write /Library/Preferences/com.apple.softwareupdate CatalogURL $LSUS
echo "Setting System SUS to $NAME Lion Branch."
;;
*10.8*)
defaults write /var/root/Library/Preferences/com.apple.softwareupdate CatalogURL $MLSUS
defaults write /Library/Preferences/com.apple.softwareupdate CatalogURL $MLSUS
echo "Setting Sytem SUS to $NAME Mountain Lion Branch."
;;
esac
#Sets User-Level com.apple.SoftwareUpdate.plist for all users who have it
for d in /Users/*
do
if [ -e "$d/Library/Preferences/com.apple.Softwareupdate.plist" ]
then
case $OSversion in
*10.6*)
defaults write $d/Library/Preferences/com.apple.softwareupdate CatalogURL $SLSUS
echo "Setting SUS to $NAME Lion Branch for User $d"
;;
*10.7*)
defaults write $d/Library/Preferences/com.apple.softwareupdate CatalogURL $LSUS
echo "Setting SUS to $NAME Lion Branch for User $d"
;;
*10.8*)
defaults write $d/Library/Preferences/com.apple.softwareupdate CatalogURL $MLSUS
echo "Setting SUS to $NAME Lion Branch for User $d"
;;
esac
else
if [ -e "$d/Library/Preferences/.GlobalPreferences.plist" ];then
cp /Library/Preferences/com.apple.softwareupdate.plsit $d/Library/Preferences/com.apple.softwareupdate.plsit
echo "Setting SUS to $NAME for User $d"
else
echo "The file was not found under $d skipping
fi
fi
done