Improve install.sh
This commit is contained in:
parent
a8dfaf6af8
commit
55e8c6aacf
|
@ -1,6 +1,6 @@
|
|||
#!/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
|
||||
[[ -f ~/.bash_aliases && ! -z $(cat ~/.bash_aliases | grep c_red) ]] && exit 1
|
||||
|
||||
echo 'export c_blinkfast="\033[6m"
|
||||
export c_light="\033[1m"
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
# Install IPFS
|
||||
ipfs() {
|
||||
echo -e "${c_yellow}Onboarding IPFS...$c_"
|
||||
[[ -f /usr/local/bin/ipfs ]] && sudo service ipfs stop
|
||||
if [[ $ARM == "yes" ]]; then
|
||||
wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update"
|
||||
else
|
||||
wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-amd64.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update"
|
||||
fi
|
||||
|
||||
echo "INSTALL ipfs-update"
|
||||
sudo tar -xvzf $MY_PATH/ipfs-update.tar.gz -C /usr/src/ || err+="Untar ipfs-update"
|
||||
rm $MY_PATH/ipfs-update.tar.gz
|
||||
cd /usr/src/ipfs-update/
|
||||
sudo ./install.sh || err+="Install ipfs-update"
|
||||
cd $MY_PATH
|
||||
|
||||
echo "INSTALL latest ipfs"
|
||||
sudo ipfs-update install latest || err+="Install IPFS"
|
||||
|
||||
echo "CREATE SYSTEMD ipfs SERVICE"
|
||||
[[ -f /etc/systemd/system/ipfs.service ]] && sudo rm /etc/systemd/system/ipfs.service
|
||||
sudo cp -f $MY_PATH/templates/1/ipfs.service /etc/systemd/system/
|
||||
sudo sed -i "s/_USER/$USER/g" /etc/systemd/system/ipfs.service
|
||||
|
||||
sudo systemctl daemon-reload || err+="Restart IPFS"
|
||||
sudo systemctl enable ipfs || err+="Enable IPFS daemon"
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
scuttlebutt() {
|
||||
echo "TODO"
|
||||
}
|
76
install.sh
76
install.sh
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
# Author: Poka (poka@p2p.legal)
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# Version: 0.2
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
# Git: https://git.p2p.legal/axiom-team/astroport
|
||||
################################################################################
|
||||
|
@ -18,6 +18,8 @@ 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
|
||||
|
@ -32,7 +34,7 @@ help() {
|
|||
|
||||
## Get arguments
|
||||
args="$@"
|
||||
[[ $args =~ all ]] && all=true
|
||||
apps=$(echo "$@" | tr " " ",")
|
||||
|
||||
## Vérifie le type de système
|
||||
[[ $(uname -a | grep arm) ]] && ARM=yes || unset isARM
|
||||
|
@ -47,45 +49,21 @@ 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_"
|
||||
[[ -f /usr/local/bin/ipfs ]] && sudo service ipfs stop
|
||||
if [[ $ARM == "yes" ]]; then
|
||||
wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update"
|
||||
else
|
||||
wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-amd64.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update"
|
||||
fi
|
||||
|
||||
echo "INSTALL ipfs-update"
|
||||
sudo tar -xvzf $MY_PATH/ipfs-update.tar.gz -C /usr/src/ || err+="Untar ipfs-update"
|
||||
rm $MY_PATH/ipfs-update.tar.gz
|
||||
cd /usr/src/ipfs-update/
|
||||
sudo ./install.sh || err+="Install ipfs-update"
|
||||
cd $MY_PATH
|
||||
|
||||
echo "INSTALL latest ipfs"
|
||||
sudo ipfs-update install latest || err+="Install IPFS"
|
||||
|
||||
echo "CREATE SYSTEMD ipfs SERVICE"
|
||||
[[ -f /etc/systemd/system/ipfs.service ]] && sudo rm /etc/systemd/system/ipfs.service
|
||||
sudo cp -f $MY_PATH/templates/1/ipfs.service /etc/systemd/system/
|
||||
sudo sed -i "s/_USER/$USER/g" /etc/systemd/system/ipfs.service
|
||||
|
||||
sudo systemctl daemon-reload || err+="Restart IPFS"
|
||||
sudo systemctl enable ipfs || err+="Enable IPFS daemon"
|
||||
}
|
||||
source .install/ipfs.sh
|
||||
|
||||
# Install ScuttleButt
|
||||
scuttlebutt() {
|
||||
echo "TODO"
|
||||
source .install/scuttlebutt.sh
|
||||
|
||||
# Install iptubes
|
||||
iptubes() {
|
||||
source iptubes/install.sh
|
||||
}
|
||||
|
||||
# Install IPTubes
|
||||
iptubes() {
|
||||
# Install Torrengo
|
||||
torrengo() {
|
||||
cd $MY_PATH/iptubes
|
||||
## Install GO
|
||||
wget https://dl.google.com/go/go1.13.4.linux-amd64.tar.gz -P /tmp/
|
||||
|
@ -108,21 +86,31 @@ iptubes() {
|
|||
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_"
|
||||
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
|
||||
[[ -z $args ]] && echo -e "Select a gate to install:" && read apps
|
||||
[[ -z $apps ]] && echo -e "${c_red}Unknown gate \"$args\"$c_" && exit 1
|
||||
|
||||
echo -e "${c_green}Good trip !$c_"
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue