1
1
mirror of https://github.com/ellie/atuin.git synced 2024-08-17 17:00:33 +03:00

feat: use cargo-dist installer from our install script (#2108)

* feat: use cargo-dist installer from our install script

* shellcheck
This commit is contained in:
Ellie Huxtable 2024-06-10 16:36:10 +01:00 committed by GitHub
parent 1ea10b0a08
commit b88c42f3f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -35,11 +35,6 @@ elif ! command -v sed &> /dev/null; then
exit
fi
LATEST_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/atuinsh/atuin/releases/latest)
# Allow sed; sometimes it's more readable than ${variable//search/replace}
# shellcheck disable=SC2001
LATEST_VERSION=$(echo "$LATEST_RELEASE" | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
__atuin_install_arch(){
echo "Arch Linux detected!"
@ -71,22 +66,8 @@ __atuin_install_arch(){
}
__atuin_install_deb_based(){
if [ "$(dpkg --print-architecture)" = "amd64" ]; then
echo "Detected distro: $OS"
ARTIFACT_URL="https://github.com/atuinsh/atuin/releases/download/$LATEST_VERSION/atuin_${LATEST_VERSION//v/}_amd64.deb"
TEMP_DEB="$(mktemp)".deb &&
curl -Lo "$TEMP_DEB" "$ARTIFACT_URL"
if command -v sudo &> /dev/null; then
sudo apt install "$TEMP_DEB"
else
su -l -c "apt install '$TEMP_DEB'"
fi
rm -f "$TEMP_DEB"
else
echo "$OS detected, but not amd64"
__atuin_install_unsupported
fi
__atuin_install_binary(){
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/atuinsh/atuin/releases/latest/download/atuin-installer.sh | sh
}
__atuin_install_linux(){
@ -104,10 +85,9 @@ __atuin_install_linux(){
"arch" | "manjarolinux" | "endeavouros")
__atuin_install_arch;;
"ubuntu" | "ubuntuwsl" | "debian" | "linuxmint" | "parrot" | "kali" | "elementary" | "pop" | "neon" | "tuxedo")
__atuin_install_deb_based;;
__atuin_install_binary;;
*)
# TODO: download a binary or smth
__atuin_install_unsupported;;
__atuin_install_binary;;
esac
}
@ -119,8 +99,8 @@ __atuin_install_mac(){
echo "Installing with brew"
brew install atuin
else
echo "Could not find brew, installing with Cargo"
__atuin_install_unsupported
echo "Could not find brew, installing a binary"
__atuin_install_binary
fi
}