Support Apple arm for rg install
parent
c53cf5cdff
commit
893d8d18bc
@ -1,27 +1,46 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
|
set -euo pipefail
|
||||||
|
|
||||||
function get_os () {
|
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
|
||||||
case $(uname -s) in
|
|
||||||
Linux*) echo unknown-linux-musl;;
|
|
||||||
Darwin*) echo apple-darwin;;
|
|
||||||
*) >&2 echo "unsupported os: $(uname -s)"; exit 1;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
main () (
|
||||||
APP=rg
|
APP=rg
|
||||||
VERSION=${VERSION:-14.1.0}
|
VERSION=${VERSION:-14.1.1}
|
||||||
DEST="${XDG_DATA_HOME}/apps/releases/${APP}"
|
DEST="${XDG_DATA_HOME}/apps/releases/${APP}"
|
||||||
URL=https://github.com/BurntSushi/ripgrep/releases/download/${VERSION}/ripgrep-${VERSION}-$(uname -m)-$(get_os).tar.gz
|
URL=https://github.com/BurntSushi/ripgrep/releases/download/${VERSION}/ripgrep-${VERSION}-$(get_arch)-$(get_os).tar.gz
|
||||||
|
|
||||||
|
set -x
|
||||||
extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-component 1"
|
extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-component 1"
|
||||||
|
set +x
|
||||||
set_current_link "${DEST}" "${VERSION}"
|
set_current_link "${DEST}" "${VERSION}"
|
||||||
|
set -x
|
||||||
|
|
||||||
mkdir_if_missing "${XDG_CONFIG_HOME}/bash/bashrc.d"
|
mkdir_if_missing "${XDG_CONFIG_HOME}/bash/bashrc.d"
|
||||||
mkdir_if_missing "${XDG_CONFIG_HOME}/fish/completions"
|
mkdir_if_missing "${XDG_CONFIG_HOME}/fish/completions"
|
||||||
|
mkdir_if_missing "${MAN_DIR}"
|
||||||
|
|
||||||
|
set +x
|
||||||
set_link "${XDG_BIN_HOME}/rg" "${DEST}" rg
|
set_link "${XDG_BIN_HOME}/rg" "${DEST}" rg
|
||||||
set_link "${MAN_DIR}/rg.1" "${DEST}" doc/rg.1
|
set_link "${MAN_DIR}/rg.1" "${DEST}" doc/rg.1
|
||||||
set_link "${XDG_CONFIG_HOME}/bash/bashrc.d/ripgrep.sh" "${DEST}" complete/rg.bash
|
set_link "${XDG_CONFIG_HOME}/bash/bashrc.d/ripgrep.sh" "${DEST}" complete/rg.bash
|
||||||
set_link "${XDG_CONFIG_HOME}/fish/completions/ripgrep.fish" "${DEST}" complete/rg.fish
|
set_link "${XDG_CONFIG_HOME}/fish/completions/ripgrep.fish" "${DEST}" complete/rg.fish
|
||||||
|
)
|
||||||
|
|
||||||
|
get_arch () (
|
||||||
|
MACHINE=$(uname -m)
|
||||||
|
case "$MACHINE" in
|
||||||
|
arm64) echo aarch64 ;;
|
||||||
|
*) echo "$MACHINE" ;;
|
||||||
|
esac
|
||||||
|
)
|
||||||
|
|
||||||
|
get_os () (
|
||||||
|
case $(uname -s) in
|
||||||
|
Linux*) echo unknown-linux-musl;;
|
||||||
|
Darwin*) echo apple-darwin;;
|
||||||
|
*) >&2 echo "unsupported os: $(uname -s)"; exit 1;;
|
||||||
|
esac
|
||||||
|
)
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
Loading…
Reference in New Issue