#!/bin/bash ################################################################################ # Author: Poka (poka@p2p.legal) # Author: Fred (support@qo-op.com) # Version: 0.2 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) # Git: https://git.p2p.legal/axiom-team/astroport ################################################################################ ## Check if root user if [ "$EUID" -eq 0 ] then echo -e "${c_red}Please do not execute this script in root user.$c_" exit 1 fi echo -e "Installing Astroport" MY_PATH="`dirname \"$0\"`" MY_PATH="`( cd \"$MY_PATH\" && pwd )`" now=$(date +%Y-%m-%d) unset apps errors=0 ## Get profile [[ -f $MY_PATH/.profile ]] && source $MY_PATH/.profile || touch $MY_PATH/.profile help() { clear echo -e "${c_light}Welcome onboard !$c_ - No arguments yet " exit 0 } ## Get arguments args="$@" apps=$(echo "$@" | tr " " ",") ## Vérifie le type de système [[ $(uname -a | grep arm) ]] && ARM=yes || unset isARM if [[ $(grep -E 'stretch|18.|19.' /etc/os-release) ]]; then OS=stretch; elif [[ $(grep buster /etc/os-release) ]]; then OS=buster; else echo "${c_red}Votre OS n'est pas supporté$c_"; exit 1; fi sed -i 's/_OS/$OS/g' $MY_PATH/.profile sed -i 's/_ARM/$ARM/g' $MY_PATH/.profile sed -i 's/_GPATH/$MY_PATH/g' $MY_PATH/.profile chmod u+x $MY_PATH/.install/*.sh $MY_PATH/.install/export_colors.sh [[ -f ~/.bash_aliases ]] && source ~/.bash_aliases # -------------------------------------------- # Install IPFS source .install/ipfs.sh # Install ScuttleButt source .install/scuttlebutt.sh # Install iptubes iptubes() { source iptubes/install.sh } # Install Torrengo torrengo() { cd $MY_PATH/iptubes ## Install GO wget https://dl.google.com/go/go1.13.4.linux-amd64.tar.gz -P /tmp/ sudo tar -C /usr/local -xzf /tmp/go1.13.4.linux-amd64.tar.gz export PATH=$PATH:/usr/local/go/bin source ~/.profile ## Install torrengo go get github.com/juliensalinas/torrengo go build github.com/juliensalinas/torrengo go get github.com/juliensalinas/torrengo/ygg sudo chmod ug+x torrengo pathTorrengo=$(realpath torrengo) cd /usr/bin sudo ln -sf $pathTorrengo . cd $MY_PATH rm /tmp/go1.13.4.linux-amd64.tar.gz } # -------------------------- # Check installs functions=$(declare -F | awk '{print $NF}' | sort | egrep -v "^_" ) ## Check IPFS install [[ -z $(which ipfs) ]] && ipfs echo -e "${c_green}Astroport UP$c_" [[ -z $args ]] && echo -e "Select a gate to install:" && read apps [[ -z $apps ]] && echo -e "${c_red}Unknown gate \"$args\"$c_" && exit 1 while read gate; do if [[ "$functions" == *"$gate"* ]]; then echo -e "${c_yellow}Installing gate $gate ...$c_" $gate else errors="${c_red}Unknown gate \"$gate\"$c_" fi done <<<$(echo "$apps" | sed -n 1'p' | tr ',' '\n') if [[ $errors == 0 ]]; then echo -e "${c_green}Good trip !$c_" else echo -e "${c_red}An error has occurred:$c_ \n- $errors" fi exit 0