2020-02-19 03:06:35 +03:00
|
|
|
#!/usr/bin/env bash
|
2020-12-18 00:16:04 +03:00
|
|
|
set -euo pipefail
|
2020-02-19 03:06:35 +03:00
|
|
|
|
2020-04-30 14:52:54 +03:00
|
|
|
pushd() {
|
2021-06-28 19:36:55 +03:00
|
|
|
builtin pushd "$@" > /dev/null
|
2020-04-30 14:52:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
popd() {
|
2021-06-28 19:36:55 +03:00
|
|
|
builtin popd > /dev/null
|
2020-04-30 14:52:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
pkg_json_version() {
|
|
|
|
jq -r .version package.json
|
|
|
|
}
|
|
|
|
|
2020-05-12 00:08:22 +03:00
|
|
|
vscode_version() {
|
2022-03-15 05:37:29 +03:00
|
|
|
jq -r .version lib/vscode/package.json
|
2020-05-12 00:08:22 +03:00
|
|
|
}
|
|
|
|
|
2020-04-30 14:52:54 +03:00
|
|
|
os() {
|
2022-08-04 19:03:28 +03:00
|
|
|
osname=$(uname | tr '[:upper:]' '[:lower:]')
|
|
|
|
case $osname in
|
|
|
|
linux)
|
|
|
|
# Alpine's ldd doesn't have a version flag but if you use an invalid flag
|
|
|
|
# (like --version) it outputs the version to stderr and exits with 1.
|
|
|
|
# TODO: Better to check /etc/os-release; see ../install.sh.
|
|
|
|
ldd_output=$(ldd --version 2>&1 || true)
|
|
|
|
if echo "$ldd_output" | grep -iq musl; then
|
|
|
|
osname="alpine"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
darwin) osname="macos" ;;
|
|
|
|
cygwin* | mingw*) osname="windows" ;;
|
|
|
|
esac
|
|
|
|
echo "$osname"
|
2020-04-30 14:52:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
arch() {
|
2021-06-17 20:28:54 +03:00
|
|
|
cpu="$(uname -m)"
|
|
|
|
case "$cpu" in
|
2022-08-04 19:03:28 +03:00
|
|
|
aarch64) cpu=arm64 ;;
|
|
|
|
x86_64) cpu=amd64 ;;
|
2020-04-30 14:52:54 +03:00
|
|
|
esac
|
2022-08-04 19:03:28 +03:00
|
|
|
echo "$cpu"
|
2020-02-19 03:06:35 +03:00
|
|
|
}
|
2020-05-12 00:08:22 +03:00
|
|
|
|
2020-05-16 17:55:46 +03:00
|
|
|
rsync() {
|
|
|
|
command rsync -a --del "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
VERSION="$(pkg_json_version)"
|
|
|
|
export VERSION
|
|
|
|
ARCH="$(arch)"
|
|
|
|
export ARCH
|
|
|
|
OS=$(os)
|
|
|
|
export OS
|
|
|
|
|
|
|
|
# RELEASE_PATH is the destination directory for the release from the root.
|
|
|
|
# Defaults to release
|
|
|
|
RELEASE_PATH="${RELEASE_PATH-release}"
|