From ee8169a7740848310fbcf97bf9fe90b5b7d225b7 Mon Sep 17 00:00:00 2001 From: Zack T Date: Fri, 14 Feb 2020 22:37:23 -0700 Subject: [PATCH] v1.8.0 = Fixed the things I broke + Added the LicenseInfo Function back in (not sure what I was thinking here) + Changed `cd` back to the bash built-in + Corrected the variable that's used for the Java binary + Improved comments --- Software/SPSS Statistics/license_SPSS.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Software/SPSS Statistics/license_SPSS.sh b/Software/SPSS Statistics/license_SPSS.sh index 158adb9..926ce02 100644 --- a/Software/SPSS Statistics/license_SPSS.sh +++ b/Software/SPSS Statistics/license_SPSS.sh @@ -3,7 +3,7 @@ ################################################################################################### # Script Name: license_SPSS.sh # By: Zack Thompson / Created: 1/3/2018 -# Version: 1.7.0 / Updated: 1/27/2020 / By: ZT +# Version: 1.8.0 / Updated: 2/14/2020 / By: ZT # # Description: This script applies the license for SPSS applications. # @@ -55,6 +55,7 @@ echo "Licensing Mechanism: ${licenseMechanism}" ################################################## # Define Licensing Details +LicenseInfo() { if [[ $licenseType == "Academic" ]]; then licenseManager="server.company.com" commuterDays="7" @@ -94,18 +95,20 @@ echo "Licensing Mechanism: ${licenseMechanism}" ;; esac fi +} ################################################## # Bits staged, license software... -# Find all installed SPSS versions. +# Find all installed versions of SPSS. appPaths=$( /usr/bin/find -E /Applications -iregex ".*[/](SPSS) ?(Statistics) ?([0-9]{2})?[.]app" -type d -prune ) -# Verify that a SPSS version was found. +# Verify at least one version of SPSS was found. if [[ -z "${appPaths}" ]]; then echo "A version of SPSS was not found in the expected location!" echo "***** License SPSS process: FAILED *****" exit 3 + else # If the machine has multiple SPSS Applications, loop through them... while IFS="\n" read -r appPath; do @@ -125,9 +128,12 @@ else versionSPSS=$( /usr/bin/defaults read "${spssContents}/Info.plist" CFBundleShortVersionString | /usr/bin/awk -F "." '{print $1}' ) # Set the Network License file path networkLicense="${spssBin}/spssprod.inf" - # Set the Local License Location file path + # Set the Local License file path localLicense="${spssBin}/lservrc" + # Function LicenseInfo + LicenseInfo + ################################################## # Setting permissions to resolve issues seen in: https://www-01.ibm.com/support/docview.wss?uid=swg21966637 @@ -153,6 +159,7 @@ else javaProp="-Djava.version=1.5 -Dis.headless=true -Djava.awt.headless=true" spssActivator="${spssBin}/licenseactivator.jar" + # Preferably use the bundled JRE. if [[ -e "${spssJRE}" ]]; then javaBinary="${spssJRE}" else @@ -164,10 +171,8 @@ else LC_ALL=en_US fi - export LC_ALL - # Apply License Code - exitStatus="${spssJRE}" "${javaProp}" -jar "${spssActivator}" "SILENTMODE" "CODES=${licenseCode}" + exitStatus=$( cd "${spssBin}" && "${javaBinary}" "${javaProp}" -jar "${spssActivator}" "SILENTMODE" "CODES=${licenseCode}" ) if [[ $exitStatus == *"Authorization succeeded"* ]]; then echo "License Code applied successfully!"