diff options
Diffstat (limited to 'taskcluster/docker/snap-coreXX-build/install-snap.sh')
-rwxr-xr-x | taskcluster/docker/snap-coreXX-build/install-snap.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/taskcluster/docker/snap-coreXX-build/install-snap.sh b/taskcluster/docker/snap-coreXX-build/install-snap.sh new file mode 100755 index 0000000000..66f64d088d --- /dev/null +++ b/taskcluster/docker/snap-coreXX-build/install-snap.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -ex + +SNAP_TO_INSTALL=$1 + +if [ -z "${SNAP_TO_INSTALL}" ]; then + echo "Please give a snap name" + exit 1 +fi + +# Grab the requested snap from the stable channel and unpack it in the proper +# place (the 'Snap-CDN: none' header allows building in restricted network +# environments such as Launchpad builders) + +# shellcheck disable=SC2046 +curl -L \ + -H 'Snap-CDN: none' \ + $(curl -H 'X-Ubuntu-Series: 16' "https://api.snapcraft.io/api/v1/snaps/details/${SNAP_TO_INSTALL}?channel=stable" | jq '.download_url' -r) \ + --output "${SNAP_TO_INSTALL}.snap" + +mkdir -p "/snap/${SNAP_TO_INSTALL}" + +unsquashfs -d "/snap/${SNAP_TO_INSTALL}/current" "${SNAP_TO_INSTALL}.snap" |