Add install shellcheck script
parent
8f19a7016b
commit
e9ad5d2cf4
@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
|
||||||
|
|
||||||
|
function get_os () {
|
||||||
|
case $(uname -s) in
|
||||||
|
Linux*) echo linux;;
|
||||||
|
Darwin*) echo darwin;;
|
||||||
|
*) >&2 echo "unsupported os: $(uname -s)"; exit 1;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_arch () {
|
||||||
|
case $(uname -m) in
|
||||||
|
amd64*|x86_64*) echo x86_64;;
|
||||||
|
arm|armv7*|armv6*) echo armv6hf;;
|
||||||
|
aarch64*|armv8*) echo aarch64;;
|
||||||
|
*) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
APP=shellcheck
|
||||||
|
DEST="${XDG_DATA_HOME}/apps/releases/${APP}"
|
||||||
|
CURRENT="${DEST}/current"
|
||||||
|
VERSION=${VERSION:-0.7.2}
|
||||||
|
URL=https://github.com/koalaman/shellcheck/releases/download/v${VERSION}/shellcheck-v${VERSION}.$(get_os).$(get_arch).tar.xz
|
||||||
|
|
||||||
|
extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-components 1"
|
||||||
|
set_current_link "${DEST}" "${VERSION}"
|
||||||
|
|
||||||
|
unlink_if_set "${XDG_BIN_HOME}/${APP}"
|
||||||
|
cd "${XDG_BIN_HOME}" || exit 1
|
||||||
|
ln -s "$(relative_path "${XDG_BIN_HOME}" "${CURRENT}/${APP}")" "${APP}"
|
||||||
|
cd - &> /dev/null || exit 1
|
Loading…
Reference in New Issue