diff --git a/.install/export_colors.sh b/.install/export_colors.sh new file mode 100755 index 0000000..08ef4f0 --- /dev/null +++ b/.install/export_colors.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +[[ -f ~/.bash_aliases && ! -z $(cat ~/.bash_aliases | grep c_red) ]] && echo "Les couleurs sont déjà déclarés dans l'environnement" && exit 1 + +echo 'export c_blinkfast="\033[6m" +export c_light="\033[1m" +export c_white_bg="\033[47m" +export c_blue="\033[34m" +export c_red_bg="\033[41m" +export c_hide="\033[8m" +export c_purple_bg="\033[45m" +export c_yellow_bg="\033[43m" +export c_dark="\033[2m" +export c_reverse="003[7m" +export c_underline="\033[4m" +export c_blinkslow="\033[5m" +export c_red="\033[31m" +export c_white="\033[37m" +export c_cyan_bg="\033[46m" +export c_italic="\033[3m" +export c_black="\033[30m" +export c_cross="\033[9m" +export c_green="\033[32m" +export c_purple="\033[35m" +export c_="\033[0m" +export c_cyan="\033[36m" +export c_black_bg="\033[40m" +export c_yellow="\033[33m" +export c_blue_bg="\033[44m" +export c_green_bg="\033[42m"' >> ~/.bash_aliases + +source ~/.bash_aliases + diff --git a/.profile b/.profile new file mode 100644 index 0000000..e69de29 diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index 36cdca1..6e1e832 --- a/install.sh +++ b/install.sh @@ -1,7 +1,55 @@ #!/bin/bash +################################################################################ +# Author: Poka (poka@p2p.legal) +# Author: Fred (support@qo-op.com) +# Version: 0.1 +# 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) + +## 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="$@" +[[ $args =~ all ]] && all=true + +## 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 ipfs() { echo -e "${c_yellow}Onboarding IPFS...$c_" @@ -33,15 +81,15 @@ ipfs() { # Install ScuttleButt scuttlebutt() { - + echo "TODO" } # Install IPTubes iptubes() { - cd $ASTROPATH/iptubes + cd $MY_PATH/iptubes ## Install GO - wget https://dl.google.com/go/go1.13.4.linux-amd64.tar.gz - sudo tar -C /usr/local -xzf go1.13.4.linux-amd64.tar.gz + 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 @@ -50,16 +98,31 @@ iptubes() { go build github.com/juliensalinas/torrengo go get github.com/juliensalinas/torrengo/ygg - sudo mv torrengo /usr/bin - sudo cd /usr/bin 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 ## Check IPFS install -[[ $force_req == "o" || -z $(which ipfs) ]] && ipfs +[[ -z $(which ipfs) ]] && ipfs -echo -e "Installation Complete" +echo -e "${c_green}Astroport UP$c_" +echo -e "Select a gate to install:" +#read gate +gate="iptubes" +case $gate in + iptubes) iptubes;; +# flattg) flattg;; + *) echo -e "${c_yellow}Bye !$c_";; +esac + +echo -e "${c_green}Good trip !$c_" exit 0