Last active
February 18, 2016 10:34
-
-
Save opragel/6f754858945eba10c302 to your computer and use it in GitHub Desktop.
Deploy ArchiCAD hotfixes silently, from a URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# borrowed from @filipp's gist: https://gist.github.com/filipp/8975071 | |
# sh <(curl -fSsk https://gist.githubusercontent.com/filipp/8975071/raw) https://example.com/hotfix.dmg | |
MOUNTPOINT=/tmp/InstallACFix | |
CACHEDIR=$(getconf DARWIN_USER_CACHE_DIR) | |
if [[ $# -eq 0 ]]; then | |
echo "Usage: $(basename "$0")" url_to_dmg 2>&1 | |
exit 0 | |
else | |
hotfixURL=$1 | |
dmgFileName=$(basename "$hotfixURL") | |
dmgPath="$CACHEDIR/$dmgFileName" | |
fi | |
echo "Downloading $dmgFileName..." | |
/usr/bin/curl --retry 3 "$hotfixURL" -o "$dmgPath" | |
if [[ $? -gt 0 ]]; then | |
echo "Failed to download hotfix image" 2>&1 | |
exit 1 | |
fi | |
if [[ ! -d $MOUNTPOINT ]]; then | |
/bin/mkdir $MOUNTPOINT | |
fi | |
/usr/bin/hdiutil attach -nobrowse "$dmgPath" -mountpoint $MOUNTPOINT > /dev/null 2>&1 | |
if [[ $? -gt 0 ]]; then | |
echo "Failed to mount hotfix image" 2>&1 | |
exit 1 | |
fi | |
$MOUNTPOINT/ArchiCAD*.app/Contents/MacOS/ArchiCAD* -silent | |
/usr/bin/hdiutil detach $MOUNTPOINT | |
/bin/rm -f "$dmgPath" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment