Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion OS_Upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
# 17: Logged in user is not on the list of the FileVault enabled users.
# 18: Password mismatch. User may have forgotten their password.
# 19: FileVault error with fdesetup. Authenticated restart unsuccessful.
# 21: Installer failed validation. Replace your installer and try again.

# Variables to determine paths, OS version, disk space, and power connection. Do not edit.
available_free_space=$(/bin/df -g / | /usr/bin/tail -1 | /usr/bin/awk '{print $4}')
Expand Down Expand Up @@ -484,6 +485,17 @@ minOSReqCheck (){
return 0
}

# Command to check validity of the installer package. If it's not valid, the install process resets and warns the user.
checkPackage () {
echo "Running validity check."
codesign -v $mac_os_installer_path
if [[ $? != 0 ]]; then
echo "Installer package is invalid. Reseting process"
"$jamfHelper" -windowType utility -icon "$alerticon" -heading "Installation Failure" -description "$upgrade_error" -button1 "Exit" -defaultButton 1 &
exit 21
fi
}

# Function that determines what OS is on the macOS installer.app so that the appropriate startosinstall options are used as Apple has changed it with 10.12.4
# Supply a parameter $1 for this function that includes the macOS app installer you are using to upgrade.
installCommand (){
Expand Down Expand Up @@ -546,6 +558,10 @@ installOS (){
exit 0
}

# Check the package is valid before installing
echo "Checking package integrity."
checkPackage

if [[ ! -e "$mac_os_installer_path" ]]; then
downloadOSInstaller

Expand All @@ -566,4 +582,4 @@ else
installOS ""
fi

exit 0
exit 0