Code Improvements

+ Code Improvements
This commit is contained in:
Zack T
2018-04-03 11:14:52 -07:00
parent 9c984807c2
commit 3787882a28
15 changed files with 156 additions and 150 deletions

View File

@@ -3,13 +3,13 @@
###################################################################################################
# Script Name: build_Maple.sh
# By: Zack Thompson / Created: 1/8/2018
# Version: 1.1.1 / Updated: 1/25/2018 / By: ZT
# Version: 1.1.2 / Updated: 3/30/2018 / By: ZT
#
# Description: This script uses munkipkg to build an Maple package.
#
###################################################################################################
/bin/echo "***** Build Maple process: START *****"
echo "***** Build Maple process: START *****"
##################################################
# Define Variables
@@ -65,8 +65,8 @@ function cleanUp {
##################################################
# Find out what we want to do...
/bin/echo "Build Type: $switch1"
/bin/echo "Version: $switch3"
echo "Build Type: $switch1"
echo "Version: $switch3"
case $switch1 in
-install )
@@ -96,5 +96,5 @@ case $switch1 in
;;
esac
/bin/echo "***** Build Maple process: COMPLETE *****"
echo "***** Build Maple process: COMPLETE *****"
exit 0

View File

@@ -3,19 +3,19 @@
###################################################################################################
# Script Name: install_Maple.sh
# By: Zack Thompson / Created: 3/2/2017
# Version: 1.5 / Updated: 1/31/2018 / By: ZT
# Version: 1.5.1 / Updated: 3/30/2018 / By: ZT
#
# Description: This script silently installs Maple.
#
###################################################################################################
/bin/echo "***** Install Maple process: START *****"
echo "***** Install Maple process: START *****"
##################################################
# Define Variables
# Set working directory
pkgDir=$(/usr/bin/dirname $0)
pkgDir=$(/usr/bin/dirname "${0}")
# Java JDK Directory
jdkDir="/Library/Java/JavaVirtualMachines"
# Version that's being updated (this will be set by the build_Maple.sh script)
@@ -25,26 +25,26 @@
# Bits staged...
if [[ ! -d $(/usr/bin/find $jdkDir -iname 1.6*.jdk) ]]; then
/bin/echo "Java JDK 1.6 is required for full Maple functionality: Installing..."
echo "Java JDK 1.6 is required for full Maple functionality: Installing..."
# Apple update 'Java for OS X 2015-001' is required for Maples as well, installing that here.
/usr/sbin/installer -dumplog -verbose -pkg "${pkgDir}/JavaForOSX.pkg" -target /
/bin/echo 'Java JDK installed!'
echo 'Java JDK installed!'
fi
# Install Maple
/bin/echo "Installing Maple..."
echo "Installing Maple..."
exitStatus=$("${pkgDir}/Maple${version}MacInstaller.app/Contents/MacOS/installbuilder.sh" --mode unattended)
exitCode=$?
if [[ $exitCode != 0 ]]; then
/bin/echo "ERROR: Install failed!"
/bin/echo "Exit Code: ${exitCode}"
/bin/echo "Exit status was: ${exitStatus}"
/bin/echo "***** Install Maple process: FAILED *****"
echo "ERROR: Install failed!"
echo "Exit Code: ${exitCode}"
echo "Exit status was: ${exitStatus}"
echo "***** Install Maple process: FAILED *****"
exit 1
fi
/bin/echo "Install complete!"
/bin/echo "***** Install Maple process: COMPLETE *****"
echo "Install complete!"
echo "***** Install Maple process: COMPLETE *****"
exit 0

View File

@@ -3,13 +3,13 @@
###################################################################################################
# Script Name: license_Maple.sh
# By: Zack Thompson / Created: 1/8/2018
# Version: 1.5.1 / Updated: 2/7/2018 / By: ZT
# Version: 1.5.2 / Updated: 3/30/2018 / By: ZT
#
# Description: This script applies the license for Maple applications.
#
###################################################################################################
/usr/bin/logger -s "***** License Maple process: START *****"
echo "***** License Maple process: START *****"
##################################################
# Turn on case-insensitive pattern matching
@@ -24,8 +24,8 @@ shopt -s nocasematch
licenseMechanism="Local"
;;
* )
/usr/bin/logger -s "ERROR: Invalid License Mechanism provided"
/usr/bin/logger -s "***** License Maple process: FAILED *****"
echo "ERROR: Invalid License Mechanism provided"
echo "***** License Maple process: FAILED *****"
exit 1
;;
esac
@@ -33,7 +33,7 @@ shopt -s nocasematch
# Turn off case-insensitive pattern matching
shopt -u nocasematch
/usr/bin/logger -s "Licensing Mechanism: ${licenseMechanism}"
echo "Licensing Mechanism: ${licenseMechanism}"
##################################################
# Bits staged, license software...
@@ -43,8 +43,8 @@ appPaths=$(/usr/bin/find -E /Applications -iregex ".*Maple [0-9]{4}[.]app" -maxd
# Verify that a Maple version was found.
if [[ -z "${appPaths}" ]]; then
/usr/bin/logger -s "A version of Maple was not found in the expected location!"
/usr/bin/logger -s "***** License Maple process: FAILED *****"
echo "A version of Maple was not found in the expected location!"
echo "***** License Maple process: FAILED *****"
exit 2
else
# If the machine has multiple Maple Applications, loop through them...
@@ -52,7 +52,7 @@ else
# 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}"
echo "Applying License for Major Version: ${majorVersion}"
# Location of the License File
licenseFile="/Library/Frameworks/Maple.framework/Versions/${majorVersion}/license/license.dat"
@@ -60,7 +60,7 @@ else
if [[ -d "${appPath}" ]]; then
if [[ $licenseMechanism == "Network" ]]; then
/usr/bin/logger -s "Configuring the License Manager Server..."
echo "Configuring the License Manager Server..."
/bin/cat > "${licenseFile}" <<licenseContents
#
@@ -114,23 +114,23 @@ activateLicense
)
if [[ $exitStatus == *"Activation successful!"* ]]; then
/usr/bin/logger -s "License Code applied successfully!"
/usr/bin/logger -s "Maple ${majorVersion} has been activated!"
echo "License Code applied successfully!"
echo "Maple ${majorVersion} has been activated!"
else
/usr/bin/logger -s "ERROR: Failed to apply License Code for: Maple ${majorVersion}"
/usr/bin/logger -s "ERROR Contents: $(/bin/echo ${exitStatus} | /usr/bin/xargs)"
/usr/bin/logger -s "***** License Maple process: FAILED *****"
echo "ERROR: Failed to apply License Code for: Maple ${majorVersion}"
echo "ERROR Contents: $(echo ${exitStatus} | /usr/bin/xargs)"
echo "***** License Maple process: FAILED *****"
fi
fi
fi
if [[ $(/usr/bin/stat -f "%OLp" "${licenseFile}") != "666" ]]; then
# Set permissions on default permissions on the file.
/usr/bin/logger -s "Applying permissions to license file..."
echo "Applying permissions to license file..."
/bin/chmod 666 "${licenseFile}"
fi
done < <(/bin/echo "${appPaths}")
done < <(echo "${appPaths}")
fi
/usr/bin/logger -s "***** License Maple process: COMPLETE *****"
echo "***** License Maple process: COMPLETE *****"
exit 0

View File

@@ -3,22 +3,22 @@
###################################################################################################
# Script Name: update_Maple.sh
# By: Zack Thompson / Created: 3/2/2017
# Version: 1.5 / Updated: 1/31/2018 / By: ZT
# Version: 1.5.1 / Updated: 3/30/2018 / By: ZT
#
# Description: This script silently installs a Maple update.
#
###################################################################################################
/bin/echo "***** Update Maple process: START *****"
echo "***** Update Maple process: START *****"
##################################################
# Define Variables
# Set working directory
pkgDir=$(/usr/bin/dirname $0)
pkgDir=$(/usr/bin/dirname "${0}")
# Version that's being updated (this will be set by the build_Maple.sh script)
version=
majorVersion=$(/bin/echo "${version}" | /usr/bin/awk -F "." '{print $1}')
majorVersion=$(echo "${version}" | /usr/bin/awk -F "." '{print $1}')
# Get the location of Maple.app
appPath=$(/usr/bin/find /Applications -iname "Maple ${majorVersion}.app" -maxdepth 3 -type d -prune)
# Get the current Maple version
@@ -27,27 +27,27 @@
##################################################
# Bits staged...
/bin/echo "Current version: ${currentVersion}"
/bin/echo "Updating to version: ${version}"
echo "Current version: ${currentVersion}"
echo "Updating to version: ${version}"
# Update Maple
/bin/echo "Updating Maple..."
echo "Updating Maple..."
exitStatus=$("${pkgDir}/Maple${version}MacUpgrade.app/Contents/MacOS/installbuilder.sh" --mode unattended)
exitCode=$?
if [[ $exitCode != 0 ]]; then
/bin/echo "ERROR: Update failed!"
/bin/echo "Exit code was: ${exitCode}"
/bin/echo "Exit status was: ${exitStatus}"
/bin/echo "***** Update Maple process: FAILED *****"
echo "ERROR: Update failed!"
echo "Exit code was: ${exitCode}"
echo "Exit status was: ${exitStatus}"
echo "***** Update Maple process: FAILED *****"
exit 1
elif [[ $(/usr/bin/defaults read "${appPath}/Contents/Info.plist" CFBundleShortVersionString) != "${version}" ]]; then
/bin/echo "Injecting the proper version string into Maple's Info.plist"
echo "Injecting the proper version string into Maple's Info.plist"
# Inject the proper version into the Info.plist file -- this may not be required for every version; but was not done in 2016.0X updates
/usr/bin/sed -i '' 's/'"${currentVersion}"'/'"${version}"'/g;s/2016.00/'"${version}"'/g' "${appPath}/Contents/Info.plist"
fi
/bin/echo "Update complete!"
/bin/echo "***** Update Maple process: COMPLETE *****"
echo "Update complete!"
echo "***** Update Maple process: COMPLETE *****"
exit 0

View File

@@ -3,13 +3,13 @@
###################################################################################################
# Script Name: build_Mathematica.sh
# By: Zack Thompson / Created: 1/10/2018
# Version: 1.1 / Updated: 1/24/2018 / By: ZT
# Version: 1.1.1 / Updated: 4/2/2018 / By: ZT
#
# Description: This script uses munkipkg to build an Mathematica package.
#
###################################################################################################
/bin/echo "***** Build Mathematica process: START *****"
echo "***** Build Mathematica process: START *****"
##################################################
# Define Variables
@@ -28,7 +28,7 @@ softwareTitle="Mathematica"
# Setup Functions
function getHelp {
/bin/echo "
echo "
usage: build_Mathematica.sh [-install] [-version] <value> -help
Info: Uses munkipkg to build a package for use in Jamf.
@@ -61,8 +61,8 @@ function cleanUp {
##################################################
# Find out what we want to do...
/bin/echo "Build Type: $switch1"
/bin/echo "Version: $switch3"
echo "Build Type: $switch1"
echo "Version: $switch3"
case $switch1 in
-install )
@@ -78,5 +78,5 @@ case $switch1 in
;;
esac
/bin/echo "***** Build Mathematica process: COMPLETE *****"
echo "***** Build Mathematica process: COMPLETE *****"
exit 0

View File

@@ -3,13 +3,13 @@
###################################################################################################
# Script Name: license_Mathematica.sh
# By: Zack Thompson / Created: 1/10/2018
# Version: 1.1 / Updated: 1/29/2018 / By: ZT
# Version: 1.1.1 / Updated: 4/2/2018 / By: ZT
#
# Description: This script applies the license for Mathematica applications.
#
###################################################################################################
/usr/bin/logger -s "***** License Mathematica process: START *****"
echo "***** License Mathematica process: START *****"
##################################################
# Define Variables
@@ -21,11 +21,11 @@ licenseFile="${licenseDirectory}/mathpass"
# Create the license file.
if [[ ! -d "${licenseDirectory}" ]]; then
/usr/bin/logger -s "Creating License Directory..."
echo "Creating License Directory..."
/bin/mkdir -p "${licenseDirectory}"
fi
/usr/bin/logger -s "Creating license file..."
echo "Creating license file..."
/bin/cat > "${licenseFile}" <<licenseContents
!license.server.com
@@ -34,15 +34,15 @@ licenseContents
if [[ -e "${licenseFile}" ]]; then
# Set permissions on the file for everyone to be able to read.
/usr/bin/logger -s "Applying permissions to license file..."
echo "Applying permissions to license file..."
/bin/chmod 644 "${licenseFile}"
else
/usr/bin/logger -s "ERROR: Failed to create the license file!"
/usr/bin/logger -s "***** License Mathematica process: FAILED *****"
echo "ERROR: Failed to create the license file!"
echo "***** License Mathematica process: FAILED *****"
exit 1
fi
/usr/bin/logger -s "Mathematica has been activated!"
/usr/bin/logger -s "***** License Mathematica process: COMPLETE *****"
echo "Mathematica has been activated!"
echo "***** License Mathematica process: COMPLETE *****"
exit 0

View File

@@ -3,13 +3,13 @@
###################################################################################################
# Script Name: build_Matlab.sh
# By: Zack Thompson / Created: 1/10/2018
# Version: 1.1 / Updated: 1/23/2018 / By: ZT
# Version: 1.1.1 / Updated: 4/2/2018 / By: ZT
#
# Description: This script uses munkipkg to build an Matlab package.
#
###################################################################################################
/bin/echo "***** Build Matlab process: START *****"
echo "***** Build Matlab process: START *****"
##################################################
# Define Variables
@@ -28,7 +28,7 @@ softwareTitle="Matlab"
# Setup Functions
function getHelp {
/bin/echo "
echo "
usage: build_Matlab.sh [-install] [-version] <value> -help
Info: Uses munkipkg to build a package for use in Jamf.
@@ -61,8 +61,8 @@ function cleanUp {
##################################################
# Find out what we want to do...
/bin/echo "Build Type: $switch1"
/bin/echo "Version: $switch3"
echo "Build Type: $switch1"
echo "Version: $switch3"
case $switch1 in
-install )
@@ -81,5 +81,5 @@ case $switch1 in
;;
esac
/bin/echo "***** Build Matlab process: COMPLETE *****"
echo "***** Build Matlab process: COMPLETE *****"
exit 0

View File

@@ -3,19 +3,19 @@
###################################################################################################
# Script Name: install_MatLab.sh
# By: Zack Thompson / Created: 3/6/2017
# Version: 1.5 / Updated: 1/31/2018 / By: ZT
# Version: 1.6 / Updated: 3/29/2018 / By: ZT
#
# Description: This script installs MatLab.
#
###################################################################################################
/bin/echo "***** Install Matlab process: START *****"
echo "***** Install Matlab process: START *****"
##################################################
# Define Variables
# Set working directory
pkgDir=$(/usr/bin/dirname $0)
pkgDir=$(/usr/bin/dirname "${0}")
# Version that's being updated (this will be set by the build_Matlab.sh script)
version=
@@ -23,31 +23,37 @@
# Bits staged...
# Install MatLab with option file.
/bin/echo "Installing Matlab..."
echo "Installing Matlab..."
if [[ $version == "2017a" ]]; then
# Inject dummy location to the installer.input file -- hacky, but works
LANG=C /usr/bin/sed -Ei '' 's,(#)?licensePath=.*,'"licensePath=${pkgDir}/installer_input.txt"',' "${pkgDir}/installer_input.txt"
# -mode silent did not work in the option file for me.
exitStatus=$("${pkgDir}/install" -mode silent -inputFile "${pkgDir}/installer_input.txt")
else
elif [[ $version == "2017b" ]]; then
# I'm assuming all future version will be packaged in this manner...(/hoping)..?
exitStatus=$("${pkgDir}/InstallForMacOSX.app/Contents/MacOS/InstallForMacOSX" -inputFile "${pkgDir}/installer_input.txt")
else
# 2018a did not work like 2017b unfortunately, where I didn't have to specify the licensePath...
# Inject dummy location to the installer.input file -- hacky, but works
LANG=C /usr/bin/sed -Ei '' 's,(#)?licensePath=.*,'"licensePath=${pkgDir}/installer_input.txt"',' "${pkgDir}/installer_input.txt"
exitStatus=$("${pkgDir}/InstallForMacOSX.app/Contents/MacOS/InstallForMacOSX" -inputFile "${pkgDir}/installer_input.txt")
fi
exitCode=$?
if [[ $exitCode != 0 ]]; then
/bin/echo "Exit Code: ${exitCode}"
echo "Exit Code: ${exitCode}"
fi
if [[ $exitStatus == *"End - Unsuccessful"* ]]; then
/bin/echo "ERROR: Install failed!"
/bin/echo "ERROR Content: ${exitStatus}"
/bin/echo "***** Install Matlab process: FAILED *****"
echo "ERROR: Install failed!"
echo "ERROR Content: ${exitStatus}"
echo "***** Install Matlab process: FAILED *****"
exit 1
fi
/bin/echo "Install complete!"
/bin/echo "***** Install Matlab process: COMPLETE *****"
echo "Install complete!"
echo "***** Install Matlab process: COMPLETE *****"
exit 0

View File

@@ -3,13 +3,13 @@
###################################################################################################
# Script Name: license_Matlab.sh
# By: Zack Thompson / Created: 1/10/2018
# Version: 1.1 / Updated: 1/30/2018 / By: ZT
# Version: 1.1.1 / Updated: 4/2/2018 / By: ZT
#
# Description: This script applies the license for Matlab applications.
#
###################################################################################################
/usr/bin/logger -s "***** License Matlab process: START *****"
echo "***** License Matlab process: START *****"
##################################################
# Define Variables
@@ -19,8 +19,8 @@ appPaths=$(/usr/bin/find /Applications -iname "Matlab*.app" -maxdepth 1 -type d)
# Verify that a Matlab version was found.
if [[ -z "${appPaths}" ]]; then
/usr/bin/logger -s "A version of Matlab was not found in the expected location!"
/usr/bin/logger -s "***** License Matlab process: FAILED *****"
echo "A version of Matlab was not found in the expected location!"
echo "***** License Matlab process: FAILED *****"
exit 1
else
# If the machine has multiple Matlab Applications, loop through them...
@@ -28,7 +28,7 @@ else
# Get the Matlab version
appVersion=$(/bin/cat "${appPath}/VersionInfo.xml" | /usr/bin/grep release | /usr/bin/awk -F "<(/)?release>" '{print $2}')
/usr/bin/logger -s "Applying License for Version: ${appVersion}"
echo "Applying License for Version: ${appVersion}"
# Build the license file location
licenseFile="${appPath}/licenses/network.lic"
@@ -36,7 +36,7 @@ else
##################################################
# Create the license file.
/usr/bin/logger -s "Creating license file..."
echo "Creating license file..."
/bin/cat > "${licenseFile}" <<licenseContents
SERVER license.server.com 11000
@@ -45,16 +45,16 @@ licenseContents
if [[ -e "${licenseFile}" ]]; then
# Set permissions on the file for everyone to be able to read.
/usr/bin/logger -s "Applying permissions to license file..."
echo "Applying permissions to license file..."
/bin/chmod 644 "${licenseFile}"
else
/usr/bin/logger -s "ERROR: Failed to create the license file!"
/usr/bin/logger -s "***** License Matlab process: FAILED *****"
echo "ERROR: Failed to create the license file!"
echo "***** License Matlab process: FAILED *****"
exit 2
fi
done < <(/bin/echo "${appPaths}")
done < <(echo "${appPaths}")
fi
/usr/bin/logger -s "Matlab has been activated!"
/usr/bin/logger -s "***** License Matlab process: COMPLETE *****"
echo "Matlab has been activated!"
echo "***** License Matlab process: COMPLETE *****"
exit 0

View File

@@ -3,13 +3,13 @@
###################################################################################################
# Script Name: build_SPSS.sh
# By: Zack Thompson / Created: 1/5/2018
# Version: 1.2 / Updated: 1/26/2018 / By: ZT
# Version: 1.2.1 / Updated: 4/2/2018 / By: ZT
#
# Description: This script uses munkipkg to build an SPSS package.
#
###################################################################################################
/bin/echo "***** Build SPSS process: START *****"
echo "***** Build SPSS process: START *****"
##################################################
# Define Variables
@@ -25,13 +25,13 @@ softwareTitle="SPSSStatistics"
scriptDirectory=$(/usr/bin/dirname "$(/usr/bin/stat -f "$0")")
# Get the Major Version
majorVersion=$(/bin/echo "${switch3}" | /usr/bin/awk -F "." '{print $1}')
majorVersion=$(echo "${switch3}" | /usr/bin/awk -F "." '{print $1}')
##################################################
# Setup Functions
function getHelp {
/bin/echo "
echo "
usage: build_SPSS.sh [-install] [-update] [-version] <value> -help
Info: Uses munkipkg to build a package for use in Jamf.
@@ -68,8 +68,8 @@ function cleanUp {
##################################################
# Find out what we want to do...
/bin/echo "Build Type: $switch1"
/bin/echo "Version: $switch3"
echo "Build Type: $switch1"
echo "Version: $switch3"
case $switch1 in
-install )
@@ -102,5 +102,5 @@ case $switch1 in
;;
esac
/bin/echo "***** Build SPSS process: COMPLETE *****"
echo "***** Build SPSS process: COMPLETE *****"
exit 0

View File

@@ -3,33 +3,33 @@
###################################################################################################
# Script Name: uninstall_SPSS.sh
# By: Zack Thompson / Created: 11/1/2017
# Version: 1.2 / Updated: 1/25/2018 / By: ZT
# Version: 1.2.1 / Updated: 4/2/2018 / By: ZT
#
# Description: Remove previous version(s) of SPSS from /Applications
#
###################################################################################################
/bin/echo "***** Uninstall SPSS process: START *****"
echo "***** Uninstall SPSS process: START *****"
/bin/echo "Searching for existing SPSS instances..."
echo "Searching for existing SPSS instances..."
appPaths=$(/usr/bin/find -E /Applications -iregex ".*[/](SPSS) ?(Statistics) ?([0-9]{2})?[.]app" -type d -prune)
# Verify that a SPSS version was found.
if [[ -z "${appPaths}" ]]; then
/bin/echo "Did not find an instance SPSS!"
echo "Did not find an instance SPSS!"
else
# If the machine has multiple SPSS Applications, loop through them...
while IFS="\n" read -r appPath; do
# Get the App Bundle name
appName=$(/bin/echo $appPath | /usr/bin/awk -F "/" '{print $NF}')
appName=$(echo $appPath | /usr/bin/awk -F "/" '{print $NF}')
# Get only the install path
installPath=$(/bin/echo $appPath | /usr/bin/awk -F "/$appName" '{print $1}')
installPath=$(echo $appPath | /usr/bin/awk -F "/$appName" '{print $1}')
# Delete the old version
/bin/echo "Uninstalling: ${appPath}"
echo "Uninstalling: ${appPath}"
/bin/rm -rf "${installPath}"
done < <(/bin/echo "${appPaths}")
done < <(echo "${appPaths}")
fi
/bin/echo "***** Uninstall SPSS process: COMPLETE *****"
echo "***** Uninstall SPSS process: COMPLETE *****"
exit 0

View File

@@ -3,13 +3,13 @@
###################################################################################################
# Script Name: license_Fetch.sh
# By: Zack Thompson / Created: 6/28/2017
# Version: 1.1 / Updated: 2/16/2018 / By: ZT
# Version: 1.1.1 / Updated: 3/30/2018 / By: ZT
#
# Description: This script will license Fetch with ASU's License.
# Description: This script will license Fetch.
#
###################################################################################################
/bin/echo "***** license Fetch Process: START *****"
echo "***** license Fetch Process: START *****"
##################################################
# Define Variables
@@ -22,20 +22,20 @@ serialNumber="FETCH12345-6789-0123-4567-8910-1112"
# Bits staged...
if [[ ! -x $FetchApp ]]; then
/bin/echo "Error: Fetch is not properly installed."
/bin/echo "***** license Fetch Process: FAILED *****"
echo "Error: Fetch is not properly installed."
echo "***** license Fetch Process: FAILED *****"
exit 1
else
/bin/echo "Applying the Fetch license..."
echo "Applying the Fetch license..."
/usr/bin/defaults write $plist SerialNumber "$serialNumber"
/usr/bin/defaults write $plist RegistrantName "$registrantName"
if [[ -e $plist ]]; then
/bin/echo "Fetch has been licensed!"
/bin/echo "***** license Fetch Process: COMPLETE *****"
echo "Fetch has been licensed!"
echo "***** license Fetch Process: COMPLETE *****"
else
/bin/echo "Error: License does not exist."
/bin/echo "***** license Fetch Process: FAILED *****"
echo "Error: License does not exist."
echo "***** license Fetch Process: FAILED *****"
exit 2
fi
fi

View File

@@ -3,13 +3,13 @@
###################################################################################################
# Script Name: license_Minitab.sh
# By: Zack Thompson / Created: 3/6/2017
# Version: 1.1 / Updated: 1/10/2018 / By: ZT
# Version: 1.1.1 / Updated: 3/30/2018 / By: ZT
#
# Description: This script applies the license for Minitab.
#
###################################################################################################
/usr/bin/logger -s "***** License Minitab process: START *****"
echo "***** License Minitab process: START *****"
##################################################
# Define Variables
@@ -19,20 +19,20 @@ licenseFile="/Library/Application Support/Minitab/Minitab Express/mtblic.plist"
##################################################
# Bits staged, license software...
/usr/bin/logger -s "Configuring the License Manager Server..."
echo "Configuring the License Manager Server..."
/usr/bin/defaults write "${licenseFile}" "License File" @license.server.com
if [[ -e "${licenseFile}" ]]; then
# Set permissions on the file for everyone to be able to read.
/usr/bin/logger -s "Applying permissions to license file..."
echo "Applying permissions to license file..."
/bin/chmod 644 "${licenseFile}"
else
/usr/bin/logger -s "ERROR: Failed to create the license file!"
/usr/bin/logger -s "***** License Minitab process: FAILED *****"
echo "ERROR: Failed to create the license file!"
echo "***** License Minitab process: FAILED *****"
exit 1
fi
/usr/bin/logger -s "Minitab has been activated!"
/usr/bin/logger -s "***** License Minitab process: COMPLETE *****"
echo "Minitab has been activated!"
echo "***** License Minitab process: COMPLETE *****"
exit 0

View File

@@ -3,13 +3,13 @@
###################################################################################################
# Script Name: license_Parallels.sh
# By: Zack Thompson / Created: 8/17/2017
# Version: 1.5.1 / Updated: 1/23/2018 / By: ZT
# Version: 1.5.2 / Updated: 3/30/2018 / By: ZT
#
# Description: This script will apply a Parallels License provided as a JSS Script Parameter.
# Description: This script will apply a Parallels License provided as a Script Parameter.
#
###################################################################################################
/bin/echo "***** license_Parallels Process: START *****"
echo "***** license_Parallels Process: START *****"
##################################################
# Define Variables
@@ -22,18 +22,18 @@ serviceParallels="/Applications/Parallels Desktop.app/Contents/MacOS/Parallels S
# First, check to make sure that the prlsrvctl binary exists and is executable.
if [[ ! -x "${Parallels}" ]]; then
/bin/echo "Error: Parallels is not properly installed."
/bin/echo "***** license_Parallels Process: FAILED *****"
echo "Error: Parallels is not properly installed."
echo "***** license_Parallels Process: FAILED *****"
exit 1
else
# Second, check if the Parallels Service is running, if not, start it.
if $(! $(/usr/bin/pgrep -xq prl_disp_service)); then
/bin/echo "The Parallels Service is not running -- Starting it now..."
echo "The Parallels Service is not running -- Starting it now..."
"${serviceParallels}" &
# If needed, waiting for the service to start...
until [[ $(/usr/bin/pkill -0 -ix prl_disp_service -q 2>/dev/null) -eq 0 ]]; do
/bin/echo "Waiting for the Parallels Service to start..."
echo "Waiting for the Parallels Service to start..."
/bin/sleep 1
done
fi
@@ -46,23 +46,23 @@ else
# Fourth, if the current status is active, we'll need to deactivate it, before activating a new license.
if [[ $status == "ACTIVE" ]]; then
/bin/echo "Machine currently has an active license."
/bin/echo "Deactivating old license..."
echo "Machine currently has an active license."
echo "Deactivating old license..."
"${Parallels}" deactivate-license
fi
# Fifth, install new license.
/bin/echo "Applying the provided license..."
echo "Applying the provided license..."
"${Parallels}" install-license --key "${licenseKey}"
exitCode=$?
# Sixth, check the result of installing the license.
if [[ $exitCode = 0 ]]; then
/bin/echo "Parallels has been licensed!"
/bin/echo "***** license_Parallels Process: COMPLETE *****"
echo "Parallels has been licensed!"
echo "***** license_Parallels Process: COMPLETE *****"
else
/bin/echo "Error: License was likely invalid."
/bin/echo "***** license_Parallels Process: FAILED *****"
echo "Error: License was likely invalid."
echo "***** license_Parallels Process: FAILED *****"
exit 2
fi
fi

View File

@@ -3,7 +3,7 @@
###################################################################################################
# Script Name: license_VMwareFusion.sh
# By: Zack Thompson / Created: 12/14/2017
# Version: 1.0.1 / Updated: 1/18/2018 / By: ZT
# Version: 1.0.2 / Updated: 3/30/2018 / By: ZT
#
# Description: This script will apply a VMware Fusion License provided as a JSS Script Parameter.
# - Supports VMware Fusion 4.x and later.
@@ -11,26 +11,26 @@
#
###################################################################################################
/bin/echo "***** license_VMwareFusion Process: START *****"
echo "***** license_VMwareFusion Process: START *****"
# Define Variables
FusionApp="/Applications/VMware Fusion.app"
if [[ ! -x $FusionApp ]]; then
/bin/echo "Error: VMware Fusion is not properly installed."
/bin/echo "***** license_VMwareFusion Process: FAILED *****"
if [[ ! -x "${FusionApp}" ]]; then
echo "Error: VMware Fusion is not properly installed."
echo "***** license_VMwareFusion Process: FAILED *****"
exit 1
else
/bin/echo "Applying the VMware Fusion license..."
echo "Applying the VMware Fusion license..."
"${FusionApp}/Contents/Library/Initialize VMware Fusion.tool" set "" "" $4
exitCode=$?
if [[ $exitCode = 0 ]]; then
/bin/echo "VMware Fusion has been licensed!"
/bin/echo "***** license_VMwareFusion Process: COMPLETE *****"
echo "VMware Fusion has been licensed!"
echo "***** license_VMwareFusion Process: COMPLETE *****"
else
/bin/echo "Error: License was likely invalid."
/bin/echo "***** license_VMwareFusion Process: FAILED *****"
echo "Error: License was likely invalid."
echo "***** license_VMwareFusion Process: FAILED *****"
exit 2
fi
fi