Skip to content

Commit

Permalink
Re-added old bash script untill I can get the yes/no version working …
Browse files Browse the repository at this point in the history
…on Ubuntu
  • Loading branch information
sfaber34 committed Jun 11, 2024
1 parent 7dd10a6 commit 45e4559
Show file tree
Hide file tree
Showing 2 changed files with 325 additions and 109 deletions.
200 changes: 91 additions & 109 deletions packages/nextjs/public/runBuidlGuidlClient.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

# TODO: Add Mac and Windows prereq installs (see checkWindowsPrereqs() in index.js)
# TODO: OpenSSL...
# TODO: Need a sudo apt install for npm after nodejs

# Default values for the options
e="geth"
c="prysm"
Expand Down Expand Up @@ -50,171 +54,149 @@ while getopts ":e:c:h" opt; do
esac
done

# Function to ask for user confirmation
confirm() {
# Loop until a valid response is received
while true; do
read -r -p "$1 [Y/n]: " response
case "$response" in
[Yy]* ) return 0;; # User confirmed (yes)
[Nn]* ) return 1;; # User denied (no)
* ) echo "Please answer yes or no.";;
esac
done
}

echo "Execution client selected: $e"
echo -e "Consensus client selected: $c\n"

os_name=$(uname -s)

if [ "$os_name" = "Linux" ]; then
echo -e "\n💪 Updating apt-get packages"
sudo apt-get update
sudo apt-get upgrade -y
# echo -e "Updating apt-get packages"
# sudo apt-get update
# sudo apt-get upgrade -y

echo -e "\n🕵️ Checking for dependencies"
echo -e "\nChecking for dependencies"

if command -v node >/dev/null 2>&1; then
echo -e "\n✅ Node is installed. Version:"
echo -e "\nNode.js is installed. Version:"
node -v
else
read -r -p "❓ Node is not installed. Do you want to install it? [y/N] " response
if [[ "$response" =~ ^[Yy]$ ]]; then
echo -e "\n💪 Installing Node"
cd ~
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install -y nodejs
else
echo -e "\n👎 Node installation canceled."
fi
fi

exit

if command -v npm >/dev/null 2>&1; then
echo -e "\n✅ NPM is installed. Version:"
npm -v
else
if confirm "\n❓ NPM is not installed. Do you want to install it?"; then
echo -e "\n💪 Installing NPM"
sudo apt install npm
else
echo -e "\n👎 NPM installation canceled."
fi
echo -e "\nRun these lines to install Node.js"
echo -e "curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -"
echo -e "sudo apt install -y nodejs"
exit
# echo -e "\nInstalling Node.js"
# cd ~
# curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
# sudo apt install -y nodejs
fi

if command -v yarn >/dev/null 2>&1; then
echo -e "\n✅ Yarn is installed. Version:"
echo -e "\nYarn is installed. Version:"
yarn -v
else
if confirm "\n❓ Yarn is not installed. Do you want to install it?"; then
echo -e "\n💪 Installing Yarn"
sudo npm i yarn -g
else
echo -e "\n👎 Yarn installation canceled."
fi
echo -e "\nRun this line to install Yarn"
echo -e "sudo npm i yarn -g"
exit
# echo -e "\nInstalling Yarn"
# sudo npm i yarn -g
fi

if command -v git >/dev/null 2>&1; then
echo -e "\n✅ Git is installed. Version:"
echo -e "\nGit is installed. Version:"
git --version
else
if confirm "\n❓ Git is not installed. Do you want to install it?"; then
echo -e "\n💪 Installing Git"
sudo apt-get install git-all -y
else
echo -e "\n👎 Git installation canceled."
fi
echo -e "\nRun this line to install Git"
echo -e "sudo apt-get install git-all -y"
exit
# echo -e "\nInstalling Git"
# sudo apt-get install git-all -y
fi

# if command -v lz4 >/dev/null 2>&1; then
# echo -e "\nLZ4 is installed. Version:"
# lz4 --version
# else
# echo -e "\nInstalling LZ4"
# sudo apt-get install lz4
# fi

# if npm list -g pm2 >/dev/null 2>&1; then
# echo -e "\npm2 is installed."
# else
# echo -e "\Run this line to install pm2"
# echo -e "sudo npm install pm2@latest -g"
# exit
# # echo -e "\nInstalling pm2."
# # sudo npm install pm2@latest -g
# fi

if command -v make >/dev/null 2>&1; then
echo -e "\n✅ GNU Make is installed. Version:"
make -v
echo -e "\nGNU Make is installed. Version:"
yarn -v
else
if confirm "\n❓ GNU Make is not installed. Do you want to install it?"; then
echo -e "\n💪 Installing GNU Make"
sudo apt-get install build-essential
else
echo -e "\n👎 GNU Make installation canceled."
fi
echo -e "\nRun this line to install GNU Make"
echo -e "sudo apt-get install build-essential"
exit
# echo -e "\nInstalling Yarn"
# sudo npm i yarn -g
fi
fi

if [ "$os_name" = "Darwin" ]; then
echo -e "\n🕵️ Checking for dependencies"
echo -e "\nChecking for dependencies"

if command -v node >/dev/null 2>&1; then
echo -e "\n✅ Node is installed. Version:"
echo -e "\nNode.js is installed. Version:"
node -v
else
if confirm "\n❓ Node is not installed. Do you want to install it?"; then
echo -e "\n💪 Installing Node"
brew install node
else
echo -e "\n👎 Node installation canceled."
fi
echo -e "\nRun this line to install Node.js"
echo -e "brew install node"
exit
fi

if command -v yarn >/dev/null 2>&1; then
echo -e "\n✅ Yarn is installed. Version:"
echo -e "\nYarn is installed. Version:"
yarn -v
else
if confirm "\n❓ Yarn is not installed. Do you want to install it?"; then
echo -e "\n💪 Installing Yarn"
brew install yarn
else
echo -e "\n👎 Yarn installation canceled."
fi
echo -e "\nRun this line to install Yarn"
echo -e "brew install yarn"
exit
fi

if command -v git >/dev/null 2>&1; then
echo -e "\nGit is installed. Version:"
git --version
else
if confirm "\n❓ Git is not installed. Do you want to install it?"; then
echo -e "\n💪 Installing Git"
brew install git
else
echo -e "\n👎 Git installation canceled."
fi
echo -e "\nRun this line to install Git"
echo -e "brew install git"
exit
fi

# if npm list -g pm2 >/dev/null 2>&1; then
# echo -e "\npm2 is installed."
# else
# echo -e "\nRun this line to install pm2:"
# echo "npm i -g pm2"
# exit
# fi

if command -v make >/dev/null 2>&1; then
echo -e "\n✅ GNU Make is installed. Version:"
make -v
echo -e "\nGNU Make is installed. Version:"
yarn -v
else
if confirm "\n❓ GNU Make is not installed. Do you want to install it?"; then
echo -e "\n💪 Installing GNU Make"
brew install make
else
echo -e "\n👎 GNU Make installation canceled."
fi
echo -e "\nRun this line to install GNU Make"
echo -e "brew install make"
exit
# echo -e "\nInstalling Yarn"
# sudo npm i yarn -g
fi

if command -v gpg >/dev/null 2>&1; then
echo -e "\n✅ gnupg is installed."
echo -e "\ngnupg is installed."
else
read -r -p "❓ gnupg is not installed. Do you want to install it? [y/N] " -n 1
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
echo -e "\n💪 Installing gnupg:"
brew install gnupg
else
echo -e "\n👎 gnupg installation canceled."
fi
echo -e "\nRun this line to install gnupg:"
echo "brew install gnupg"
exit
fi

if perl -MDigest::SHA -e '1' >/dev/null 2>&1; then
echo -e "\n✅ Perl-Digest-SHA is installed."
echo -e "\nperl-Digest-SHA is installed."
else
if confirm "\n❓ Perl-Digest-SHA is not installed. Do you want to install it?"; then
echo -e "\n💪 Installing perl-Digest-SHA"
brew install perl
brew install cpanminus
cpanm Digest::SHA
else
echo -e "\n👎 Perl-Digest-SHA installation canceled."
fi
echo -e "\nRun these lines to install perl-Digest-SHA"
echo "brew install perl"
echo "brew install cpanminus"
echo "cpanm Digest::SHA"
exit
fi
fi

Expand Down
Loading

0 comments on commit 45e4559

Please sign in to comment.