-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlabconfig-install-macos-mojave-wipeload
56 lines (44 loc) · 1.58 KB
/
labconfig-install-macos-mojave-wipeload
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
#!/bin/bash
###################################################################
#
# Enable macOS wipe and load for lab Macs (10.14)
#
# Date: Thu 6 Feb 2020 15:54:23 GMT
# Version: 0.1.5
# Creator: dsavage
#
##################################################################
# # # # # #
# SYSTEM CHECKS
# # # # # #
# Check the install process isn't underway
if [ -e /macOS\ Install\ Data ]
then
# Install proces already underway
exit 0
fi
##Check if free space > 15GB
freeSpace=$( /usr/sbin/diskutil info / | grep "Free Space" | awk '{print $4}' )
if [[ ${freeSpace%.*} -ge 15 ]]; then
spaceStatus="OK"
/bin/echo "Disk Check: OK - ${freeSpace%.*} Free Space Detected"
else
spaceStatus="ERROR"
/bin/echo "Disk Check: ERROR - ${freeSpace%.*} Free Space Detected"
fi
##Start macOS Upgrade
macOS_app_vers=`defaults read "/Applications/Install macOS Mojave.app/Contents/Info" CFBundleShortVersionString | awk -F "." '{print $1$2}'`
if [ -z $macOS_app_vers ]; then
macOS_app_vers=126
fi
echo $macOS_app_vers
if [ $macOS_app_vers -ge 144 ]; then
/Applications/Install\ macOS\ Mojave.app/Contents/Resources/startosinstall --eraseinstall --agreetolicense --installpackage /Users/Shared/QuickAddLab-0.1-1.pkg --nointeraction
else
# Do a delete incase an older version is there
rm -fR "/Applications/Install macOS Mojave.app"
# Add the installer
/usr/local/bin/jamf policy -event OS-Installer-14
/Applications/Install\ macOS\ Mojave.app/Contents/Resources/startosinstall --eraseinstall --agreetolicense --installpackage /Users/Shared/QuickAddLab-0.1-1.pkg --nointeraction
fi
exit 0;