mirror of
https://github.com/mtan93/Installomator.git
synced 2026-04-09 14:23:10 +01:00
added Firefox
This commit is contained in:
@@ -55,6 +55,8 @@ downloadURLFromGit() { # $1 git user name, $2 git repo name
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# add identifiers in this case statement
|
||||||
|
|
||||||
case $identifier in
|
case $identifier in
|
||||||
|
|
||||||
GoogleChrome)
|
GoogleChrome)
|
||||||
@@ -72,6 +74,12 @@ case $identifier in
|
|||||||
appName="BBEdit.app"
|
appName="BBEdit.app"
|
||||||
expectedTeamID="W52GZAXT98"
|
expectedTeamID="W52GZAXT98"
|
||||||
;;
|
;;
|
||||||
|
Firefox)
|
||||||
|
downloadURL="https://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US"
|
||||||
|
dmgName="Firefox.dmg"
|
||||||
|
appName="Firefox.app"
|
||||||
|
expectedTeamID="43AQ936H96"
|
||||||
|
;;
|
||||||
brokenDownloadURL)
|
brokenDownloadURL)
|
||||||
downloadURL="https://broken.com/broken.dmg"
|
downloadURL="https://broken.com/broken.dmg"
|
||||||
appName="Google Chrome.app"
|
appName="Google Chrome.app"
|
||||||
@@ -94,7 +102,9 @@ case $identifier in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
dmgname="${downloadURL##*/}"
|
if [ -z "$dmgName" ]; then
|
||||||
|
dmgName="${downloadURL##*/}"
|
||||||
|
fi
|
||||||
|
|
||||||
cleanupAndExit() { # $1 = exit code
|
cleanupAndExit() { # $1 = exit code
|
||||||
if [ "$DEBUG" -eq 0 ]; then
|
if [ "$DEBUG" -eq 0 ]; then
|
||||||
@@ -130,22 +140,22 @@ fi
|
|||||||
|
|
||||||
# TODO: when user is logged in, and app is running, prompt user to quit app
|
# TODO: when user is logged in, and app is running, prompt user to quit app
|
||||||
|
|
||||||
if [ -f "$dmgname" ] && [ "$DEBUG" -eq 1 ]; then
|
if [ -f "$dmgName" ] && [ "$DEBUG" -eq 1 ]; then
|
||||||
echo "$dmgname exists and DEBUG enabled, skipping download"
|
echo "$dmgName exists and DEBUG enabled, skipping download"
|
||||||
else
|
else
|
||||||
# download the dmg
|
# download the dmg
|
||||||
echo "Downloading $downloadURL"
|
echo "Downloading $downloadURL to $dmgName"
|
||||||
if ! curl --location --fail --silent "$downloadURL" -o "$dmgname"; then
|
if ! curl --location --fail --silent "$downloadURL" -o "$dmgName"; then
|
||||||
echo "error downloading $downloadURL"
|
echo "error downloading $downloadURL"
|
||||||
cleanupAndExit 2
|
cleanupAndExit 2
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# mount the dmg
|
# mount the dmg
|
||||||
echo "Mounting $tmpDir/$dmgname"
|
echo "Mounting $tmpDir/$dmgName"
|
||||||
# set -o pipefail
|
# set -o pipefail
|
||||||
if ! dmgmount=$(hdiutil attach "$tmpDir/$dmgname" -nobrowse -readonly | tail -n 1 | cut -c 54- ); then
|
if ! dmgmount=$(hdiutil attach "$tmpDir/$dmgName" -nobrowse -readonly | tail -n 1 | cut -c 54- ); then
|
||||||
echo "Error mounting $tmpDir/$dmgname"
|
echo "Error mounting $tmpDir/$dmgName"
|
||||||
cleanupAndExit 3
|
cleanupAndExit 3
|
||||||
fi
|
fi
|
||||||
echo "Mounted: $dmgmount"
|
echo "Mounted: $dmgmount"
|
||||||
@@ -190,13 +200,13 @@ fi
|
|||||||
|
|
||||||
# copy app to /Applications
|
# copy app to /Applications
|
||||||
echo "Copy $dmgmount/$appName to $targetDir"
|
echo "Copy $dmgmount/$appName to $targetDir"
|
||||||
if ! cp -R "$dmgmount/$appName" "$targetDir"; then
|
if ! ditto "$dmgmount/$appName" "$targetDir"; then
|
||||||
echo "Error while copying!"
|
echo "Error while copying!"
|
||||||
cleanupAndExit 7
|
cleanupAndExit 7
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# set ownership to current users
|
# set ownership to current user
|
||||||
currentUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
|
currentUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
|
||||||
if [ -n "$currentUser" ]; then
|
if [ -n "$currentUser" ]; then
|
||||||
echo "Changing owner to $currentUser"
|
echo "Changing owner to $currentUser"
|
||||||
|
|||||||
Reference in New Issue
Block a user