-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlabconfig-install-macos-catalina-wipeloadremovejssrecord
66 lines (51 loc) · 2.09 KB
/
labconfig-install-macos-catalina-wipeloadremovejssrecord
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
#!/bin/bash
###################################################################
#
# Enable macOS wipe and load for lab Macs (10.15)
#
# Date: Tue 11 Feb 2020 16:17:37 GMT
# Version: 0.1.0
# Creator: ganders1
#
##################################################################
# # # # # # # #
# 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
bootDisk=`diskutil info / | grep "Device Node:" | awk '{print $3}'`
freeSpace=`df -g | grep "${Boot_Disk}" | 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 Catalina.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 154 ]; then
# Remove JSS record for machine being wiped and loaded to help ensure integrity of fresh build. It will re-enrol at the end of the process.
/usr/local/bin/jamf policy -event RemoveJSSRecord
# Perform Wipe and Load
/Applications/Install\ macOS\ Catalina.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 Catalina.app"
# Add the installer
/usr/local/bin/jamf policy -event OS-Installer-15
# Remove JSS record for machine being wiped and loaded to help ensure integrity of fresh build. It will re-enrol at the end of the process.
/usr/local/bin/jamf policy -event RemoveJSSRecord
# Perform Wipe and Load
/Applications/Install\ macOS\ Catalina.app/Contents/Resources/startosinstall --eraseinstall --agreetolicense --installpackage /Users/Shared/QuickAddLab-0.1-1.pkg --nointeraction
fi
exit 0;