1#!/bin/bash
2
3jamfbinary=$(/usr/bin/which jamf)
4doneFile="/Users/Shared/.SplashBuddyDone"
5
6sleep 15
7
8while true
9do
10loggedinuser=$(/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }')
11
12echo $loggedinuser
13
14 if [ "${loggedinuser}" == "root" ] || [ "${loggedinuser}" == "_mbsetupuser" ]; then
15 echo "is root or mbsetupuser"
16 sleep 10
17 else
18 echo "is local user"
19 break
20 fi
21done
22
23echo "Installing SplashBuddy"
24
25${jamfbinary} policy -event "install-SplashBuddy"
26
27echo "Drinking some Red Bull so the Mac doesn't fall asleep"
28caffeinate -d -i -m -u &
29caffeinatepid=$!
30
31echo "Installing Enterpise Connect"
32
33${jamfbinary} policy -event "install-enterpriseconnect"
34
35echo "Installing BlueCoat Certificate"
36
37${jamfbinary} policy -event "install-BCC"
38
39echo "Installing BlueCoat Unified Agent"
40
41${jamfbinary} policy -event "install-BCUA"
42
43echo "Installing Cisco AnyConnect"
44${jamfbinary} policy -event "install-AnyConnect"
45
46echo "Installing Skype For Business"
47${jamfbinary} policy -event "install-sfb"
48
49echo "Installing Citrix Receiver"
50${jamfbinary} policy -event "install-citrix"
51
52echo "Pulling down FileVault 2 configuration"
53${jamfbinary} policy -event "requireFV2"
54
55echo "Setting up Dock"
56${jamfbinary} policy -event "setDock"
57
58echo "Adobe Reader"
59${jamfbinary} policy -event "adobereader"
60
61echo "Installing Microsoft Office"
62${jamfbinary} policy -event "install-office"
63
64echo "Installing VPN Settings"
65${jamfbinary} policy -event "install-vpnsettings"
66
67echo "Certificate Import"
68${jamfbinary} policy -event "certimport"
69
70echo "Enterprise Connect launcher"
71${jamfbinary} policy -event "eclauncher"
72
73serial_number=`ioreg -l | grep IOPlatformSerialNumber|awk '{print $4}' | cut -d " -f 2`
74/usr/sbin/scutil --set ComputerName $serial_number
75/usr/sbin/scutil --set LocalHostName $serial_number
76/usr/sbin/scutil --set HostName $serial_number
77
78sleep 10s
79
80#adbind uses a files and processes payload to call "finalsetup"
81echo "Active Directory Binding"
82${jamfbinary} policy -event "adbind"
83
84echo "Creating done file"
85touch "$doneFile"
86
87echo "Quitting SplashBuddy"
88osascript -e 'quit app "SplashBuddy"'
89
90echo "Unloading and removing Splashbuddy Launchagent"
91launchctl unload /Library/LaunchDaemons/io.fti.splashbuddy.launch.plist
92rm -f /Library/LaunchDaemons/io.fti.splashbuddy.launch.plist
93
94echo "Deleting SplashBuddy"
95rm -rf "/Library/Application Support/SplashBuddy"
96
97echo "Deleting lunch agent"
98launchctl remove io.fti.SplashBuddy.launch
99
100echo "Drank waaaayyyyy too much Red Bull"
101kill "$caffeinatepid"
102
103
104# OS X Version check potential
105
106sw_vers_MajorNumber=`/usr/bin/sw_vers -productVersion | /usr/bin/cut -d. -f 2`
107
108# Restart in 5 seconds if version above 10.12
109if [ $sw_vers_MajorNumber -ge 12 ]; then
110 echo "software is 10.12 or lower"
111 kill -9 `pgrep loginwindow`
112else
113 echo "software is over 10.12"
114 /sbin/reboot
115fi