Skip to content

Instantly share code, notes, and snippets.

@opragel
Last active February 18, 2016 10:34
Show Gist options
  • Save opragel/6f754858945eba10c302 to your computer and use it in GitHub Desktop.
Save opragel/6f754858945eba10c302 to your computer and use it in GitHub Desktop.
Deploy ArchiCAD hotfixes silently, from a URL
#! /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