From 61d2d8069ca3ec07f9d4dd78b82591856df95c54 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Sat, 25 Jan 2025 10:44:16 +0100 Subject: [PATCH] replaced lsb_release with os-release file also supporting X-based distributions --- configure.sh | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/configure.sh b/configure.sh index 8424a7e..c8f0464 100755 --- a/configure.sh +++ b/configure.sh @@ -17,9 +17,16 @@ # along with this program. If not, see . # Get linux distro -DISTRO=$(lsb_release -is) +DISTRO=$(grep ^ID_LIKE= /etc/os-release | cut -d= -f2 | tr -d '"') +if [ -e $DISTRO ] +then + DISTRO=$(grep ^ID= /etc/os-release | cut -d= -f2 | tr -d '"') +fi +echo $DISTRO +exit -if [[ $(id -u) != "0" ]] && [[ $1 != "force" ]]; then +if [[ $(id -u) != "0" ]] && [[ $1 != "force" ]] +then echo "You must run this script as root! (To skip this, run with 'force' arg: \"./configure.sh force\")" exit 1 fi @@ -28,11 +35,14 @@ COMMON="gcc make tmux curl" ARCH_GENTOO_COMMON="$COMMON json-c libgit2 gmp openssl" # Get COMMAND -if [[ $DISTRO == "Arch" ]]; then +if [[ $DISTRO == "arch" ]] +then COMMAND="pacman -S --needed --noconfirm $ARCH_GENTOO_COMMON" -elif [[ $DISTRO == "Ubuntu" ]] || [[ $DISTRO == "Debian" ]]; then +elif [[ $DISTRO == "Ubuntu" ]] || [[ $DISTRO == "Debian" ]] +then COMMAND="apt-get install -y $COMMON libjson-c-dev libcurl4-openssl-dev libgit2-dev libgmp-dev libssl-dev" -elif [[ $DISTRO == "Gentoo" ]]; then +elif [[ $DISTRO == "Gentoo" ]] +then COMMAND="emerge -vn $ARCH_GENTOO_COMMON" # Add @@ -60,7 +70,8 @@ fi $COMMAND # Install Rust -if ! [ -x "$(command -v cargo)" ]; then +if ! [ -x "$(command -v cargo)" ] +then curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y # Install Rust and components source "$HOME/.cargo/env" fi \ No newline at end of file