ipfs.service template inside EOF (no more curl for it)
This commit is contained in:
parent
e74a76bfc8
commit
bb6f39dbf4
|
@ -26,6 +26,7 @@ fi
|
||||||
|
|
||||||
echo -e "${c_yellow}Onboarding IPFS...$c_"
|
echo -e "${c_yellow}Onboarding IPFS...$c_"
|
||||||
|
|
||||||
|
# CHECK node IP isLAN?
|
||||||
myIP=$(hostname -I | awk '{print $1}')
|
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])/")
|
||||||
|
|
||||||
|
@ -34,20 +35,33 @@ MACHINE_TYPE=`uname -m`
|
||||||
[ ${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: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 IPFS"
|
sudo ipfs-update install latest || err+="Install IPFS"
|
||||||
|
|
||||||
echo "CREATE SYSTEMD ipfs SERVICE"
|
echo "CREATE SYSTEMD ipfs SERVICE >>>>>>>>>>>>>>>>>>"
|
||||||
curl -s https://git.p2p.legal/axiom-team/astroport/raw/master/.install/templates/ipfs/ipfs.service -o /tmp/ipfs.service
|
cat > /tmp/ipfs.service <<EOF
|
||||||
|
[Unit]
|
||||||
|
Description=IPFS daemon
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=_USER_
|
||||||
|
ExecStart=/usr/local/bin/ipfs daemon --enable-pubsub-experiment --enable-namesys-pubsub --routing=dhtclient --enable-gc
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
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+="Restart IPFS"
|
sudo systemctl daemon-reload || err+="Restart IPFS"
|
||||||
sudo systemctl enable ipfs || err+="Enable IPFS daemon"
|
sudo systemctl enable ipfs || err+="Enable IPFS daemon"
|
||||||
|
@ -78,7 +92,7 @@ ipfs bootstrap add /ip6/fd42:feed:feed:feed::1/tcp/4001/p2p/Qmb6Gyy3KFWTxWh4v6fB
|
||||||
|
|
||||||
sudo systemctl restart ipfs || err+="Restart IPFS daemon"
|
sudo systemctl restart ipfs || err+="Restart IPFS daemon"
|
||||||
|
|
||||||
sleep 10
|
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) ]] && echo "${c_red}No peers found in swarm. Please open issue :https://git.p2p.legal/axiom-team/astroport/issues" && exit 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue