astroport/install.sh

103 lines
2.5 KiB
Bash
Raw Normal View History

2020-03-18 05:06:01 +01:00
#!/bin/bash
################################################################################
# Author: Poka (poka@p2p.legal)
# Author: Fred (support@qo-op.com)
2020-03-20 03:09:43 +01:00
# Version: 0.2.0
# 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
2020-03-18 05:06:01 +01:00
2020-05-06 17:32:52 +02:00
source ./git-update.sh
2020-03-18 05:06:01 +01:00
echo -e "Installing Astroport"
MY_PATH="`dirname \"$0\"`"
MY_PATH="`( cd \"$MY_PATH\" && pwd )`"
now=$(date +%Y-%m-%d)
2020-03-19 21:25:39 +01:00
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="$@"
2020-03-19 21:25:39 +01:00
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;
2020-03-19 22:26:21 +01:00
else echo "${c_red}Your OS is not supported$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
2020-03-23 19:07:37 +01:00
[[ -f ~/.bash_aliases ]] && source ~/.bash_aliases # POKA ?
# --------------------------------------------
2020-04-30 01:39:27 +02:00
# Install IPFS
ipfs() {
2020-05-06 19:51:32 +02:00
source .install/ipfs_alone.sh
2020-04-30 01:39:27 +02:00
}
2020-03-18 05:06:01 +01:00
# Install ScuttleButt
2020-03-19 21:25:39 +01:00
source .install/scuttlebutt.sh
2020-03-18 05:06:01 +01:00
2020-03-19 21:25:39 +01:00
# Install iptubes
2020-03-18 05:06:01 +01:00
iptubes() {
2020-03-19 21:25:39 +01:00
source iptubes/install.sh
}
# Install Torrengo
2020-04-30 01:39:27 +02:00
# source iptubes/install.sh torrengo
2020-03-18 05:06:01 +01:00
2020-03-19 21:25:39 +01:00
# --------------------------
2020-03-18 05:06:01 +01:00
# Check installs
2020-03-19 21:25:39 +01:00
functions=$(declare -F | awk '{print $NF}' | sort | egrep -v "^_" )
echo -e "${c_green}Astroport UP$c_"
2020-03-19 21:25:39 +01:00
[[ -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')
2020-04-29 17:05:25 +02:00
## CREATE G1SSB account
$PATH/zen/tools/make_G1SSB_secret.sh
2020-04-28 18:48:10 +02:00
## Run init scipts
$PATH/zen/ssb_IPFS_swarm.sh
$PATH/zen/cron_VRFY.sh
2020-03-19 21:25:39 +01:00
if [[ $errors == 0 ]]; then
echo -e "${c_green}Good trip !$c_"
else
echo -e "${c_red}An error has occurred:$c_ \n- $errors"
fi
2020-03-18 05:06:01 +01:00
exit 0