From e45b6da1f1f3482455d37d55324511ef9f460b42 Mon Sep 17 00:00:00 2001 From: poka Date: Sun, 17 May 2020 20:05:07 +0200 Subject: [PATCH] Fix errors states of ipfs_alone install --- .install/ipfs_alone.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/.install/ipfs_alone.sh b/.install/ipfs_alone.sh index 4868a76..5275316 100644 --- a/.install/ipfs_alone.sh +++ b/.install/ipfs_alone.sh @@ -8,6 +8,12 @@ ME="${0##*/}" # 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. EVERYTHING OK!" \ @@ -31,19 +37,19 @@ 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 IPFS" +sudo ipfs-update install latest || err "Install IPFS" echo "CREATE SYSTEMD ipfs SERVICE >>>>>>>>>>>>>>>>>>" cat > /tmp/ipfs.service <