Skip to content

Commit

Permalink
fix: script for linux
Browse files Browse the repository at this point in the history
- use user input instead of auto-detection
  • Loading branch information
ZanzyTHEbar committed May 4, 2023
1 parent 0c41a33 commit 46bda82
Showing 1 changed file with 37 additions and 12 deletions.
49 changes: 37 additions & 12 deletions scripts/setup_tauri_dev_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 46bda82

Please sign in to comment.