tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

install-snap.sh (764B)


      1 #!/bin/bash
      2 
      3 set -ex
      4 
      5 SNAP_TO_INSTALL=$1
      6 SNAP_URL=$2
      7 
      8 if [ -z "${SNAP_TO_INSTALL}" ]; then
      9  echo "Please give a snap name"
     10  exit 1
     11 fi
     12 
     13 # Grab the requested snap from the stable channel and unpack it in the proper
     14 # place (the 'Snap-CDN: none' header allows building in restricted network
     15 # environments such as Launchpad builders)
     16 
     17 if [ -z "${SNAP_URL}" ]; then
     18  SNAP_URL=$(curl -H 'X-Ubuntu-Series: 16' "https://api.snapcraft.io/api/v1/snaps/details/${SNAP_TO_INSTALL}?channel=stable" | jq '.download_url' -r)
     19 fi
     20 
     21 # shellcheck disable=SC2046
     22 curl -L -H 'Snap-CDN: none' "$SNAP_URL" --output "${SNAP_TO_INSTALL}.snap"
     23 
     24 mkdir -p "/snap/${SNAP_TO_INSTALL}"
     25 
     26 unsquashfs -d "/snap/${SNAP_TO_INSTALL}/current" "${SNAP_TO_INSTALL}.snap"
     27 
     28 rm "${SNAP_TO_INSTALL}.snap"