dot-files/dot_local/bin/executable_install-dust
Buddy 3d4f8ba8a4 fix: use rust target triple for arch in install-dust
dust's GitHub releases are named with aarch64/x86_64 (Rust target
triples), not uname -m's arm64/x86_64, so installs on Apple Silicon
downloaded a 404 body and failed with a tar "Unrecognized archive
format" error.
2026-09-22 18:23:41 -07:00

46 lines
951 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=dust
VERSION=${VERSION:-1.2.6}
DEST=${XDG_DATA_HOME}/apps/releases/${APP}
main() (
URL=https://github.com/bootandy/dust/releases/download/v${VERSION}/dust-v${VERSION}-$(get_arch)-$(get_os).tar.gz
extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-component 1"
set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}"
)
get_os() (
case $(uname -s) in
Linux*) echo unknown-linux-gnu ;;
Darwin*) echo apple-darwin ;;
*)
echo >&2 "unsupported os: $(uname -s)"
exit 1
;;
esac
)
# dust releases use Rust target triples, which differ from uname -m
get_arch() (
case $(uname -m) in
x86_64*) echo x86_64 ;;
amd64*) echo x86_64 ;;
arm64*) echo aarch64 ;;
aarch64*) echo aarch64 ;;
*)
echo >&2 "unsupported architecture: $(uname -m)"
exit 1
;;
esac
)
main "${@}"