#!/bin/bash download_and_install_cli_wallet() { echo "Select the version of cli-wallet:" echo "1. v1.5.22 - Latest Alpha Release" echo "2. v1.5.19 - Latest Production Release (Mainnet)" echo "Enter the number (1-2):" read -r version_selection case $version_selection in 1) if [[ -e "cli_wallet_1.5.22_all.deb" ]]; then echo "cli_wallet_1.5.22_all.deb already exists, skipping download." else wget https://peerplays.download/downloads/debian-files/cli-wallet/cli_wallet_1.5.22_all.deb fi sudo apt install -f ./cli_wallet_1.5.22_all.deb ;; 2) if [[ -e "cli_wallet_1.5.19_all.deb" ]]; then echo "cli_wallet_1.5.19_all.deb already exists, skipping download." else wget https://peerplays.download/downloads/debian-files/cli-wallet/cli_wallet_1.5.19_all.deb fi sudo apt install -f ./cli_wallet_1.5.19_all.deb ;; *) echo "Invalid selection. Please enter a number between 1 and 2." ;; esac } download_and_install_witness_node() { echo "Select the version of witness-node:" echo "1. v1.5.22 - Latest Alpha Release" echo "2. v1.5.19 - Latest Production Release (Mainnet)" echo "Enter the number (1-2):" read -r version_selection case $version_selection in 1) if [[ -e "witness_node_1.5.22_all.deb" ]]; then echo "witness_node_1.5.22_all.deb already exists, skipping download." else wget https://peerplays.download/downloads/debian-files/witness-node/witness_node_1.5.22_all.deb fi sudo apt install -f ./witness_node_1.5.22_all.deb ;; 2) if [[ -e "witness_node_1.5.19_all.deb" ]]; then echo "witness_node_1.5.19_all.deb already exists, skipping download." else wget https://peerplays.download/downloads/debian-files/witness-node/witness_node_1.5.19_all.deb fi sudo apt install -f ./witness_node_1.5.19_all.deb ;; *) echo "Invalid selection. Please enter a number between 1 and 2." ;; esac } download_and_install_libbitcoin3_dev_all() { if [[ -e "libbitcoin3-all-dev_3.0.0_all.deb" ]]; then echo "libbitcoin3-all-dev_3.0.0-1_all.deb already exists, skipping download." else wget https://peerplays.download/downloads/debian-files/libbitcoin-libs/libbitcoin3-all-dev_3.0.0_all.deb fi sudo apt install -f ./libbitcoin3-all-dev_3.0.0_all.deb } download_and_compile_boost1_72_0(){ if [[ -e "boost_1_72_0.tar.gz" ]]; then echo "boost_1_72_0.tar.gz already exists, skipping downloading and rebuilding from source.." exit 0 else wget https://boostorg.jfrog.io/artifactory/main/release/1.72.0/source/boost_1_72_0.tar.gz fi tar -xzf boost_1_72_0.tar.gz boost_1_72_0 cd boost_1_72_0 || return ./bootstrap.sh ./b2 sudo ./b2 install sudo ldconfig } download_and_compile_libzmq4_3_4() { if [[ -f "v4.3.4.tar.gz" || -d "libzmq-4.3.4/" ]]; then echo "Skipping downloading and compiling, directory or tarball already exists" exit 0 else wget https://github.com/zeromq/libzmq/archive/refs/tags/v4.3.4.tar.gz tar -xzvf v4.3.4.tar.gz cd libzmq-4.3.4 || return mkdir build cd build || return cmake .. make -j"$(nproc)" sudo make install sudo ldconfig fi } download_and_compile_cppzmq-4_9_0() { if [[ -f "v4.9.0.tar.gz" || -d cppzmq-4.9.0 ]]; then echo "Skipping downloading and compiling, directory or tarball already exists" exit 0 else wget https://github.com/zeromq/cppzmq/archive/refs/tags/v4.9.0.tar.gz fi tar -xzvf v4.9.0.tar.gz cd cppzmq-4.9.0 || return mkdir build cd build || return cmake .. make -j"$(nproc)" sudo make install sudo ldconfig } ##download_and_compile_cli_wallet_1_5_22(){ # # echo "Select the version of cli-wallet:" # echo "1. v1.5.22 - Latest Alpha Release (NOTE - This option grabs and compiles all required dependencies, 1.5+ hours)" # echo "2. v1.5.19 - Latest Production Release (Mainnet - - This option grabs and compiles all required dependencies, 1+ hour) " # echo "Enter the number (1-2):" # read -r version_selection # case $version_selection in # 1) # if [[ -d "peerplays/" ]]; then # echo "Skipping cloning the repository, already exists.." # else # git clone --depth 1 --branch 1.5.22-alpha https://gitlab.com/pbsa/peerplays.git # fi # # sudo apt-get install \ # autoconf bash bison build-essential ca-certificates dnsutils expect flex git \ # graphviz libbz2-dev libcurl4-openssl-dev libncurses-dev libpcre3-dev \ # libsnappy-dev libsodium-dev libssl-dev libtool libzip-dev locales lsb-release \ # mc nano net-tools ntp openssh-server pkg-config python3 python3-jinja2 sudo \ # systemd-coredump wget # # # ;; # # #} uninstall_software() { echo "Select the software you'd like to uninstall:" echo "1. cli-wallet" echo "2. witness-node" echo "3. libbitcoin3-all-dev" echo "Enter the number (1-3):" read -r software_selection case $software_selection in 1) sudo dpkg -r cli-wallet ;; 2) sudo dpkg -r witness-node ;; 3) sudo dpkg -r libbitcoin3-all-dev ;; *) echo "Invalid selection. Please enter a number between 1 and 3." ;; esac } while true; do echo "Select an action:" echo "1. Download & install software" echo "2. Build from source" echo "3. Uninstall software" echo "4. Exit" echo "Enter the number (1-4):" read -r action_selection case $action_selection in 1) while true; do echo "Select the software you'd like to download & install:" echo "1. Apps" echo "2. Libraries" echo "3. Go back" echo "Enter the number (1-3):" read -r software_selection case $software_selection in 1) while true; do echo "Select an app:" echo "1. cli-wallet" echo "2. witness-node" echo "3. Go back" echo "Enter the number (1-3):" read -r app_selection case $app_selection in 1) download_and_install_cli_wallet ;; 2) download_and_install_witness_node ;; 3) break ;; *) echo "Invalid selection. Please enter a number between 1 and 3." ;; esac done ;; 2) while true; do echo "Select a library:" echo "1. libbitcoin3-dev-all" echo "2. Go back" echo "Enter the number (1-2):" read -r library_selection case $library_selection in 1) download_and_install_libbitcoin3_dev_all ;; 2) break ;; *) echo "Invalid selection. Please enter a number between 1 and 2." ;; esac done ;; 3) break ;; *) echo "Invalid selection. Please enter a number between 1 and 3." ;; esac done ;; 2) while true; do echo "Select the software you'd like to build from source:" echo "1. Apps" echo "2. Libraries" echo "3. Go back" echo "Enter the number (1-3):" read -r software_selection case $software_selection in 1) while true; do echo "Select an app:" echo "1. cli-wallet - COMING SOON, DOESNT WORK " echo "2. witness-node - COMING SOON, DOESNT WORK" echo "3. Go back" echo "Enter the number (1-3):" read -r app_selection case $app_selection in 1) download_and_compile_cli_wallet_1_5_19 ;; 2) download_and_compile_witness_node_1_5_19 ;; 3) break ;; *) echo "Invalid selection. Please enter a number between 1 and 3." ;; esac done ;; 2) while true; do echo "Select a library:" echo "1. boost-1.72.0" echo "2. libzmq-4.3.4" echo "3. cppzmq-4.9.0" echo "4. Go back" echo "Enter the number (1-4):" read -r library_selection case $library_selection in 1) download_and_compile_boost1_72_0 ;; 2) download_and_compile_libzmq4_3_4 ;; 3) download_and_compile_cppzmq-4_9_0 ;; 4) break ;; *) echo "Invalid selection. Please enter a number between 1 and 4." ;; esac done ;; 3) break ;; *) echo "Invalid selection. Please enter a number between 1 and 3." ;; esac done ;; 3) uninstall_software ;; 4) echo "Exiting the script." exit 0 ;; *) echo "Invalid selection. Please enter a number between 1 and 4." ;; esac done