Skip to content

Commit

Permalink
[contrib/mac/app] Improve renotarize_dmg.sh (JuliaLang#36456)
Browse files Browse the repository at this point in the history
Add more error checking, allow direct pasting in of `s3:https://` URLs
  • Loading branch information
staticfloat committed Jun 30, 2020
1 parent da9325b commit aac1d68
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion contrib/mac/app/renotarize_dmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,17 @@ if [[ -z "${APPLEID}" ]] || [[ -z "${APPLEID_PASSWORD}" ]]; then
exit 1
fi

# Translate from `s3:https://` URL to `https://` url:
URL="$1"
if [[ "$URL" == s3:https://* ]]; then
# Chop off `s3:https://`
URL="${URL:5}"
# Split into bucket.s3.aws.com/path
URL="https://${URL%%/*}.s3.amazonaws.com/${URL#*/}"
fi

# Download .dmg
curl -L "$1" -O
curl -L "${URL}" -O

# Unpack dmg into our `dmg` folder
rm -rf dmg
Expand All @@ -27,6 +36,11 @@ cp -Ra /Volumes/Julia-* dmg
DMG_NAME=$(basename "$1")
APP_NAME=$(basename dmg/*.app)
VOL_NAME=$(basename /Volumes/Julia-*)

if [[ ! -d dmg/${APP_NAME} ]]; then
echo "ERORR: Unable to auto-detect APP_NAME, check dmg folder!" >&2
exit 1
fi
# Unmount everything again
for j in /Volumes/Julia-*; do hdiutil detach "${j}"; done

Expand Down

0 comments on commit aac1d68

Please sign in to comment.