diff --git a/.install/ipfs_alone.sh b/.install/ipfs_alone.sh index 4e3e951..99fa538 100644 --- a/.install/ipfs_alone.sh +++ b/.install/ipfs_alone.sh @@ -15,6 +15,12 @@ fi # Ask user password on start sudo true +## Error funciton +err() { + echo "${c_red}$1$c_" + exit 1 +} + # 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) ]] \ && 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])/") 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 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 cd /usr/src/ipfs-update/ -sudo ./install.sh || err+=" Install ipfs-update" +sudo ./install.sh || err "Install ipfs-update" cd $MY_PATH 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 >>>>>>>>>>>>>>>>>>" cat > /tmp/ipfs.service <