1#!/usr/bin/env bash
 2
 3set -euxo pipefail
 4
 5if [[ $# -gt 0 ]]; then
 6  echo "
 7  Usage: ${0##*/}
 8  Builds and installs zed onto your system into ~/.local, making it available as ~/.local/bin/zed.
 9
10  Before running this you should ensure you have all the build dependencies installed with `./script/linux`.
11  "
12  exit 1
13fi
14export ZED_CHANNEL=$(<crates/zed/RELEASE_CHANNEL)
15export ZED_UPDATE_EXPLANATION="You need to fetch and rebuild zed in $(pwd)"
16script/bundle-linux
17
18target="linux-$(uname -m)"
19commit=$(git rev-parse HEAD | cut -c 1-7)
20if  [[ "$ZED_CHANNEL" == "dev" ]]; then
21  archive="zed-${commit}-${target}.tar.gz"
22else
23  archive="zed-${target}.tar.gz"
24fi
25export ZED_BUNDLE_PATH="${CARGO_TARGET_DIR:-target}/release/${archive}"
26script/install.sh