1#!/usr/bin/env bash
2
3# This script is intended to be run after `snap-build`.
4#
5# It expects a version to be passed as the first argument, and expects
6# the built `.snap` for that version to be in the current directory.
7#
8# This will uninstall the current `zed` snap, replacing it with a snap
9# that directly uses the `snap/unpacked` directory.
10
11set -euxo pipefail
12
13if [ "$#" -ne 1 ]; then
14 echo "Usage: $0 <release_version>"
15 exit 1
16fi
17
18# Rerun as root
19[ "$UID" -eq 0 ] || exec sudo bash -e "$0" "$@"
20
21snap remove zed || true
22mkdir -p snap
23rm -rf snap/unpacked
24unsquashfs -dest snap/unpacked "zed_$1_amd64.snap"
25snap try --classic snap/unpacked