brut nature
This commit is contained in:
commit
6502cde0a0
|
@ -15,6 +15,12 @@ fi
|
||||||
# Ask user password on start
|
# Ask user password on start
|
||||||
sudo true
|
sudo true
|
||||||
|
|
||||||
|
## Error funciton
|
||||||
|
err() {
|
||||||
|
echo "${c_red}$1$c_"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# CHECK if daemon is already running
|
# CHECK if daemon is already running
|
||||||
[[ $(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) ]] \
|
[[ $(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) ]] \
|
||||||
&& echo "ipfs daemon already running...! Must STOP ipfs AND remove ~/.ipfs to install again !!" \
|
&& echo "ipfs daemon already running...! Must STOP ipfs AND remove ~/.ipfs to install again !!" \
|
||||||
|
@ -31,19 +37,20 @@ myIP=$(hostname -I | awk '{print $1}')
|
||||||
isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
|
isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
|
||||||
|
|
||||||
MACHINE_TYPE=`uname -m`
|
MACHINE_TYPE=`uname -m`
|
||||||
[ ${MACHINE_TYPE} == 'x86_64' ] && curl -s 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"
|
|
||||||
[ ${MACHINE_TYPE:0:3} == 'arm' ] && curl -s 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"
|
[ ${MACHINE_TYPE} == 'x86_64' ] && curl -s 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"
|
||||||
|
[ ${MACHINE_TYPE:0:3} == 'arm' ] && curl -s 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"
|
||||||
[ ! -f $MY_PATH/ipfs-update.tar.gz ] && echo "Your $MACHINE_TYPE is not supported yet... Please add an issue." && exit 1
|
[ ! -f $MY_PATH/ipfs-update.tar.gz ] && echo "Your $MACHINE_TYPE is not supported yet... Please add an issue." && exit 1
|
||||||
|
|
||||||
echo "INSTALL ipfs-update >>>>>>>>>>>>>>>>>>>>>>>>>>"
|
echo "INSTALL ipfs-update >>>>>>>>>>>>>>>>>>>>>>>>>>"
|
||||||
sudo tar -xvzf $MY_PATH/ipfs-update.tar.gz -C /usr/src/ || err+=" Untar 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
|
rm $MY_PATH/ipfs-update.tar.gz
|
||||||
cd /usr/src/ipfs-update/
|
cd /usr/src/ipfs-update/
|
||||||
sudo ./install.sh || err+=" Install ipfs-update"
|
sudo ./install.sh || err "Install ipfs-update"
|
||||||
cd $MY_PATH
|
cd $MY_PATH
|
||||||
|
|
||||||
echo "INSTALL latest ipfs >>>>>>>>>>>>>>>>>>>>>>>>>>"
|
echo "INSTALL latest ipfs >>>>>>>>>>>>>>>>>>>>>>>>>>"
|
||||||
sudo ipfs-update install latest || err+=" Install latest IPFS"
|
sudo ipfs-update install latest || err "Install IPFS"
|
||||||
|
|
||||||
echo "CREATE SYSTEMD ipfs SERVICE >>>>>>>>>>>>>>>>>>"
|
echo "CREATE SYSTEMD ipfs SERVICE >>>>>>>>>>>>>>>>>>"
|
||||||
cat > /tmp/ipfs.service <<EOF
|
cat > /tmp/ipfs.service <<EOF
|
||||||
|
@ -63,13 +70,16 @@ EOF
|
||||||
sudo cp -f /tmp/ipfs.service /etc/systemd/system/
|
sudo cp -f /tmp/ipfs.service /etc/systemd/system/
|
||||||
sudo sed -i "s/_USER_/$USER/g" /etc/systemd/system/ipfs.service
|
sudo sed -i "s/_USER_/$USER/g" /etc/systemd/system/ipfs.service
|
||||||
|
|
||||||
sudo systemctl daemon-reload || err+=" Reload systemd"
|
sudo systemctl daemon-reload || err "Restart IPFS"
|
||||||
sudo systemctl enable ipfs || err+=" Enable IPFS daemon startup"
|
sudo systemctl enable ipfs || err "Enable IPFS daemon"
|
||||||
|
|
||||||
# INIT ipfs
|
# INIT ipfs
|
||||||
[[ $isLAN ]] && ipfs init -p lowpower \
|
[[ $isLAN ]] && ipfs init -p lowpower \
|
||||||
|| ipfs init -p server
|
|| ipfs init -p server
|
||||||
|
|
||||||
|
sudo chown -R $USER:$USER ~/.ipfs || exit 1
|
||||||
|
|
||||||
|
|
||||||
###########################################
|
###########################################
|
||||||
# ACTIVATE IPFS OPTIONS: #swarm0 INIT
|
# ACTIVATE IPFS OPTIONS: #swarm0 INIT
|
||||||
###########################################
|
###########################################
|
||||||
|
@ -91,10 +101,11 @@ ipfs bootstrap add /ip4/51.15.166.54/tcp/4001/p2p/Qmb6Gyy3KFWTxWh4v6fBeh5ANxAF6Y
|
||||||
ipfs bootstrap add /ip6/fd42:feed:feed:feed::1/tcp/4001/p2p/Qmb6Gyy3KFWTxWh4v6fBeh5ANxAF6YAahWQtokmsNsqGda
|
ipfs bootstrap add /ip6/fd42:feed:feed:feed::1/tcp/4001/p2p/Qmb6Gyy3KFWTxWh4v6fBeh5ANxAF6YAahWQtokmsNsqGda
|
||||||
###########################################
|
###########################################
|
||||||
|
|
||||||
sudo systemctl restart ipfs || err+=" Restart IPFS daemon"
|
sudo systemctl start ipfs || err "Start IPFS daemon"
|
||||||
|
|
||||||
|
|
||||||
sleep 7
|
sleep 7
|
||||||
|
|
||||||
[[ ! $(ipfs swarm peers) ]] && echo "${c_red}No peers found in swarm. Please open issue :https://git.p2p.legal/axiom-team/astroport/issues" && exit 1
|
[[ ! $(ipfs swarm peers) ]] && err "No peers found in swarm. Please open issue :https://git.p2p.legal/axiom-team/astroport/issues" || exit 1
|
||||||
|
|
||||||
} # this ensures the entire script is downloaded #
|
} # this ensures the entire script is downloaded #
|
||||||
|
|
Loading…
Reference in New Issue