removed absolute paths from commands

This commit is contained in:
Armin Briegel
2022-06-17 15:49:00 +02:00
parent 3449c24508
commit ae7db2621c

View File

@@ -3,6 +3,8 @@
# This script is meant to povide the simplest MDM/management platform agnostic way to install Installomator # This script is meant to povide the simplest MDM/management platform agnostic way to install Installomator
# The only requirement is an Internet connection # The only requirement is an Internet connection
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Get the URL of the latest PKG From the Installomator GitHub repo # Get the URL of the latest PKG From the Installomator GitHub repo
url=$(curl --silent --fail "https://api.github.com/repos/Installomator/Installomator/releases/latest" | awk -F '"' "/browser_download_url/ && /pkg\"/ { print \$4; exit }") url=$(curl --silent --fail "https://api.github.com/repos/Installomator/Installomator/releases/latest" | awk -F '"' "/browser_download_url/ && /pkg\"/ { print \$4; exit }")
# Expected Team ID of the downloaded PKG # Expected Team ID of the downloaded PKG
@@ -13,20 +15,20 @@ exitCode=0
if [ ! -e "/usr/local/Installomator/Installomator.sh" ]; then if [ ! -e "/usr/local/Installomator/Installomator.sh" ]; then
echo "Installomator not found. Installing." echo "Installomator not found. Installing."
# Create temporary working directory # Create temporary working directory
workDirectory=$( /usr/bin/basename "$0" ) workDirectory=$( basename "$0" )
tempDirectory=$( /usr/bin/mktemp -d "/private/tmp/$workDirectory.XXXXXX" ) tempDirectory=$( mktemp -d )
echo "Created working directory '$tempDirectory'" echo "Created working directory '$tempDirectory'"
# Download the installer package # Download the installer package
echo "Downloading Installomator package" echo "Downloading Installomator package"
/usr/bin/curl --location --silent "$url" -o "$tempDirectory/Installomator.pkg" curl --location --silent "$url" -o "$tempDirectory/Installomator.pkg"
# Verify the download # Verify the download
teamID=$(/usr/sbin/spctl -a -vv -t install "$tempDirectory/Installomator.pkg" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()') teamID=$(spctl -a -vv -t install "$tempDirectory/Installomator.pkg" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()')
echo "Team ID for downloaded package: $teamID" echo "Team ID for downloaded package: $teamID"
# Install the package if Team ID validates # Install the package if Team ID validates
if [ "$expectedTeamID" = "$teamID" ] || [ "$expectedTeamID" = "" ]; then if [ "$expectedTeamID" = "$teamID" ] || [ "$expectedTeamID" = "" ]; then
echo "Package verified. Installing package Installomator.pkg" echo "Package verified. Installing package Installomator.pkg"
/usr/sbin/installer -pkg "$tempDirectory/Installomator.pkg" -target / installer -pkg "$tempDirectory/Installomator.pkg" -target / -verbose
exitCode=0 exitCode=$?
else else
echo "Package verification failed before package installation could start. Download link may be invalid. Aborting." echo "Package verification failed before package installation could start. Download link may be invalid. Aborting."
exitCode=1 exitCode=1
@@ -34,7 +36,7 @@ if [ ! -e "/usr/local/Installomator/Installomator.sh" ]; then
fi fi
# Remove the temporary working directory when done # Remove the temporary working directory when done
echo "Deleting working directory '$tempDirectory' and its contents" echo "Deleting working directory '$tempDirectory' and its contents"
/bin/rm -Rf "$tempDirectory" rm -Rf "$tempDirectory"
else else
echo "Installomator already installed." echo "Installomator already installed."
fi fi