Bug 1882457 - Update the release process docs for the monorepo migration. r=ahal...
[gecko.git] / taskcluster / docker / firefox-snap / download_and_install_snap.sh
blob7def88b2aa64c7c58f3e755431e1c2dcd8cc3510
1 #!/bin/bash
3 set -ex
5 SNAP_NAME="$1"
6 SNAP_CHANNEL="${2:-stable}"
7 SNAP_INSTALL_LOCATION="${3:-/snap}"
9 SNAP_METADATA="$(curl --header 'X-Ubuntu-Series: 16' "https://api.snapcraft.io/api/v1/snaps/details/$SNAP_NAME?channel=$SNAP_CHANNEL")"
11 set +x
12 SNAP_SHA512="$(echo "$SNAP_METADATA" | jq '.download_sha512' -r)"
13 SNAP_DOWNLOAD_URL="$(echo "$SNAP_METADATA" | jq '.download_url' -r)"
14 SNAP_LAST_UPDATED="$(echo "$SNAP_METADATA" | jq '.last_updated' -r)"
15 SNAP_REVISION="$(echo "$SNAP_METADATA" | jq '.revision' -r)"
16 SNAP_VERSION="$(echo "$SNAP_METADATA" | jq '.version' -r)"
17 set -x
19 echo "Downloading $SNAP_NAME, version $SNAP_VERSION, revision $SNAP_REVISION (last updated: $SNAP_LAST_UPDATED)..."
20 curl --location "$SNAP_DOWNLOAD_URL" --output "$SNAP_NAME.snap"
21 sha512sum -c <(echo "$SNAP_SHA512 $SNAP_NAME.snap")
23 mkdir -p "$SNAP_INSTALL_LOCATION/$SNAP_NAME"
24 unsquashfs -d "$SNAP_INSTALL_LOCATION/$SNAP_NAME/current" "$SNAP_NAME.snap"
25 rm "$SNAP_NAME.snap"
27 echo "$SNAP_NAME version $SNAP_VERSION has correctly been uploaded and installed."