From dd686ca0c67f3a0c2bad7f88885a451956b1039b Mon Sep 17 00:00:00 2001 From: Roxy Date: Fri, 7 Jul 2023 09:18:35 +0200 Subject: [PATCH] improved os detection --- installer.sh | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/installer.sh b/installer.sh index 59df511..85ec4cf 100644 --- a/installer.sh +++ b/installer.sh @@ -2,26 +2,20 @@ set -e -# Detect the operating system OS=$(awk -F= '/^NAME/{print $2}' /etc/os-release) # Install Ruby, Nginx, and Git -case $OS in - "CentOS Linux"|"Fedora") +if [[ $OS == *"CentOS"* ]] || [[ $OS == *"Fedora"* ]]; then sudo yum install -y ruby nginx git - ;; - "Arch Linux") +elif [[ $OS == *"Arch"* ]]; then sudo pacman -Syu --noconfirm ruby nginx git - ;; - "Debian GNU/Linux"|"Ubuntu"|"Raspbian GNU/Linux") +elif [[ $OS == *"Debian"* ]] || [[ $OS == *"Ubuntu"* ]] || [[ $OS == *"Raspbian"* ]]; then sudo apt-get update sudo apt-get install -y ruby nginx git - ;; - *) +else echo "Unsupported operating system: $OS" exit 1 - ;; -esac +fi # Install the 'webrick' gem if ! gem list webrick -i > /dev/null; then