diff --git a/Software/Maple/license_Maple.sh b/Software/Maple/license_Maple.sh index 80f7a76..ee92544 100755 --- a/Software/Maple/license_Maple.sh +++ b/Software/Maple/license_Maple.sh @@ -3,7 +3,7 @@ ################################################################################################### # Script Name: license_Maple.sh # By: Zack Thompson / Created: 1/8/2018 -# Version: 1.2 / Updated: 1/24/2018 / By: ZT +# Version: 1.3 / Updated: 1/25/2018 / By: ZT # # Description: This script applies the license for Maple applications. # @@ -34,24 +34,31 @@ ################################################## # Bits staged, license software... -# If the machine has multiple Maple Applications, loop through them... -/usr/bin/find -E /Applications -iregex ".*Maple [0-9]{4}[.]app" -maxdepth 3 -type d -prune | while IFS="\n" read -r appPath; do +# Find all install Maple versions. +appPaths=$(/usr/bin/find -E /Applications -iregex ".*Maple [0-9]{4}[.]app" -maxdepth 2 -type d -prune) - # Get the Maple version - majorVersion=$(/usr/bin/defaults read "${appPath}/Contents/Info.plist" CFBundleShortVersionString | /usr/bin/awk -F "." '{print $1}') - /usr/bin/logger -s "Applying License for Major Version: ${majorVersion}" +# Verify that a Maple version was found. +if [[ -z "${appPaths}" ]]; then + /usr/bin/logger -s "A version of Maple was not located in the expected location!" + /usr/bin/logger -s "***** License Maple process: FAILED *****" + exit 2 +else + # If the machine has multiple Maple Applications, loop through them... + while IFS="\n" read -r appPath; do - # Location of the License File - licenseFile="/Library/Frameworks/Maple.framework/Versions/${majorVersion}/license/license.dat" + # Get the Maple version + majorVersion=$(/usr/bin/defaults read "${appPath}/Contents/Info.plist" CFBundleShortVersionString | /usr/bin/awk -F "." '{print $1}') + /usr/bin/logger -s "Applying License for Major Version: ${majorVersion}" - if [[ -d "${appPath}" ]]; then + # Location of the License File + licenseFile="/Library/Frameworks/Maple.framework/Versions/${majorVersion}/license/license.dat" - if [[ $licenseMechanism == "Network" ]]; then + if [[ -d "${appPath}" ]]; then - /usr/bin/logger -s "Creating license file..." - /usr/bin/logger -s "Setting the License Manager Server..." + if [[ $licenseMechanism == "Network" ]]; then + /usr/bin/logger -s "Configuring the License Manager Server..." - /bin/cat > "${licenseFile}" < "${licenseFile}" <