v1.1 = Added an Exit Code Check

+ Added an Exit Code Check
 + Redirected all output to /dev/null (instead of only stdout)
This commit is contained in:
Zack T
2017-12-21 12:16:40 -07:00
parent 26386f525f
commit eae9257488

View File

@@ -3,7 +3,7 @@
###################################################################################################
# Script Name: reissue_FileVaultPRK.sh
# By: Zack Thompson / Created: 12/19/2017
# Version: 1.0 / Updated: 12/19/2017 / By: ZT
# Version: 1.1 / Updated: 12/21/2017 / By: ZT
#
# Description: This script creates a new FileVault Personal Recovery Key by passing a valid Unlock Key via JSS Parameter to the Script.
# - A valid Unlock Key can be any of: a user account password or current Personal Recovery Key
@@ -25,7 +25,7 @@ cmdFileVault="/usr/bin/fdesetup"
if [[ $fvStatus == "true" ]]; then
/usr/bin/logger -s "Machine is FileVault Encrypted."
$cmdFileVault changerecovery -personal -inputplist 1> /dev/null <<XML
$cmdFileVault changerecovery -personal -inputplist &> /dev/null <<XML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@@ -36,6 +36,14 @@ if [[ $fvStatus == "true" ]]; then
</plist>
XML
exitCode=$?
if [[ $exitCode == 11 ]]; then
/usr/bin/logger -s "Failed to issue a new Recovery Key."
/usr/bin/logger -s "***** FileVault Key Reissue process: FAILED *****"
exit 1
fi
else
/usr/bin/logger -s "Machine is not FileVault Encrypted."
fi