summaryrefslogtreecommitdiffstats
path: root/install.sh
diff options
context:
space:
mode:
authorfrukto <fruktopus@gmail.com>2023-02-10 20:38:18 +0100
committerGitHub <noreply@github.com>2023-02-10 19:38:18 +0000
commitae2124a69ce8750c5a74d3d2e9d6f5c0daf8a29a (patch)
tree252479580548dfde4f3ec3e73b77de09d587b3f1 /install.sh
parent2cec7ba677f7b25a6e489a3545219b9965997fda (diff)
Make the install script more robust (#692)
Dont't fail is a Linux system does not provide lsb_release, try to read the distro from /etc/os-release in this case.
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh21
1 files changed, 8 insertions, 13 deletions
diff --git a/install.sh b/install.sh
index da6c76289..85831d698 100755
--- a/install.sh
+++ b/install.sh
@@ -81,22 +81,17 @@ __atuin_install_ubuntu(){
__atuin_install_linux(){
echo "Detected Linux!"
echo "Checking distro..."
-
if (uname -a | grep -qi "Microsoft"); then
- OS="UbuntuWSL"
- else
- if ! command -v lsb_release &> /dev/null; then
- echo "lsb_release could not be found, unable to determine your distribution"
- echo "If you are using Arch Linux, please get community/lsb-release or install Atuin using pacman"
- echo
- __atuin_install_unsupported
- fi
- OS=$(lsb_release -i | awk '{ print $3 }')
- fi
-
+ OS="UbuntuWSL"
+ elif ! command -v lsb_release &> /dev/null; then
+ echo "lsb_release could not be found. Falling back to /etc/os-release"
+ OS="$(grep -Po '(?<=^ID=).*$' /etc/os-release)" 2>/dev/null
+ else
+ OS=$(lsb_release -i | awk '{ print $3 }')
+ fi
if [ "$OS" == "Arch" ] || [ "$OS" == "ManjaroLinux" ]; then
__atuin_install_arch
- elif [ "$OS" == "Ubuntu" ] || [ "$OS" == "UbuntuWSL" ] || [ "$OS" == "Debian" ] || [ "$OS" == "Linuxmint" ] || [ "$OS" == "Parrot" ] || [ "$OS" == "Kali" ] || [ "$OS" == "Elementary" ] || [ "$OS" == "Pop" ]; then
+ elif [ "$OS" == "Ubuntu" ] || [ "$OS" == "UbuntuWSL" ] || [ "$OS" == "Debian" ] || [ "$OS" == "Linuxmint" ] || [ "$OS" == "Parrot" ] || [ "$OS" == "Kali" ] || [ "$OS" == "Elementary" ] || [ "$OS" == "Pop" ]; then
__atuin_install_ubuntu
else
# TODO: download a binary or smth