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
# 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
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
@@ -13,20 +15,20 @@ exitCode=0
if [ ! -e "/usr/local/Installomator/Installomator.sh" ]; then
echo "Installomator not found. Installing."
# Create temporary working directory
workDirectory=$( /usr/bin/basename "$0" )
tempDirectory=$( /usr/bin/mktemp -d "/private/tmp/$workDirectory.XXXXXX" )
workDirectory=$( basename "$0" )
tempDirectory=$( mktemp -d )
echo "Created working directory '$tempDirectory'"
# Download the installer 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
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"
# Install the package if Team ID validates
if [ "$expectedTeamID" = "$teamID" ] || [ "$expectedTeamID" = "" ]; then
echo "Package verified. Installing package Installomator.pkg"
/usr/sbin/installer -pkg "$tempDirectory/Installomator.pkg" -target /
exitCode=0
installer -pkg "$tempDirectory/Installomator.pkg" -target / -verbose
exitCode=$?
else
echo "Package verification failed before package installation could start. Download link may be invalid. Aborting."
exitCode=1
@@ -34,7 +36,7 @@ if [ ! -e "/usr/local/Installomator/Installomator.sh" ]; then
fi
# Remove the temporary working directory when done
echo "Deleting working directory '$tempDirectory' and its contents"
/bin/rm -Rf "$tempDirectory"
rm -Rf "$tempDirectory"
else
echo "Installomator already installed."
fi