From 46bda827261d9d17d0c09acbb7ec98972c8c5d8a Mon Sep 17 00:00:00 2001 From: DaOfficialWizard <45744329+ZanzyTHEbar@users.noreply.github.com> Date: Thu, 4 May 2023 16:49:37 +0100 Subject: [PATCH] fix: script for linux - use user input instead of auto-detection --- scripts/setup_tauri_dev_linux.sh | 49 ++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/scripts/setup_tauri_dev_linux.sh b/scripts/setup_tauri_dev_linux.sh index 1d0fb240..df3e370f 100644 --- a/scripts/setup_tauri_dev_linux.sh +++ b/scripts/setup_tauri_dev_linux.sh @@ -8,25 +8,31 @@ if [ "$EUID" -ne 0 ]; then exit 1 fi -# Which distro are we on? -printf "Detecting Distro\n" +# get user input and store in variable -# run this command: cat /etc/*-release | uniq -u and grep for the ID field and pipe into a variable +printf "Do you want to install the Linux Development Dependencies? (y/n)\n" +read -r input -cat /etc/*-release | uniq -u | grep -i "ID" | cut -d "=" -f 2 | tr -d '"' | tr -d '\n' >distro.txt +# check if the user input is y or n + +if [ "$input" == "y" ]; then + printf "Installing Linux Development Dependencies\n" +else + printf "Not installing Linux Development Dependencies\n" +fi + +# Get their distro + +printf "Which distro are you running? (ubuntu/arch/fedora/gentoo/opensuse/void)\n" + +read -r distro -# read the variable into a variable -distro=$(cat distro.txt) -# split distro into an array -IFS=' ' read -r -a distro <<<"$distro" -# get the first element of the array -distro=${distro[0]} # convert distro to lowercase + distro=${distro,,} -# remove the file -rm distro.txt # check if the distro is Ubuntu or arch or fedora or gentoo or openSUSE or NixOS or GNU GUIX or void + if [ "$distro" == "ubuntu" ] || [ "$distro" == "arch" ] || [ "$distro" == "fedora" ] || [ "$distro" == "gentoo" ] || [ "$distro" == "opensuse" ] || [ "$distro" == "void" ]; then printf "Distro is $distro\n" else @@ -35,6 +41,25 @@ else exit 1 fi + +## Which distro are we on? +#printf "Detecting Distro\n" +# +## run this command: cat /etc/*-release | uniq -u and grep for the ID field and pipe into a variable +# +#cat /etc/*-release | uniq -u | grep -i "ID" | cut -d "=" -f 2 | tr -d '"' | tr -d '\n' >distro.txt +# +## read the variable into a variable +#distro=$(cat distro.txt) +# +## grab just the first word of the variable +#distro=$(echo $distro | cut -d " " -f 1) +# +## convert distro to lowercase +#distro=${distro,,} +## remove the file +#rm distro.txt + # Install Linux Development Dependencies # run specific commands based on the distro case $distro in