From f654a9fcf2c3c5e348ea43a341e973a0ccbca7c7 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Mon, 10 Jun 2024 12:25:06 +0300 Subject: Refactoring --- bin/ak-fs-add | 14 +++++++------- config.sh | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bin/ak-fs-add b/bin/ak-fs-add index f22432b..0a9f636 100755 --- a/bin/ak-fs-add +++ b/bin/ak-fs-add @@ -65,7 +65,7 @@ rm -rf $TEMPORARYDIR if [ ! -d "$TECHDIR" ] then mkdir -p "$TECHDIR" - if [ $? == 0 ] + if [ $? -eq 0 ] then logit "INFO" "Folder $TECHDIR created!" else @@ -80,7 +80,7 @@ fi if [ ! -d "$FILEMAPSDIR" ] then mkdir -p "$FILEMAPSDIR" - if [ $? == 0 ] + if [ $? -eq 0 ] then logit "INFO" "Folder $FILEMAPSDIR created!" else @@ -95,7 +95,7 @@ fi if [ ! -d "$CHKDIR" ] then mkdir -p "$CHKDIR" - if [ $? == 0 ] + if [ $? -eq 0 ] then logit "INFO" "Folder $CHKDIR created!" else @@ -110,7 +110,7 @@ fi if [ ! -d "$MERKLEDIR" ] then mkdir -p "$MERKLEDIR" - if [ $? == 0 ] + if [ $? -eq 0 ] then logit "INFO" "Folder $MERKLEDIR created!" else @@ -153,7 +153,7 @@ do done # Append last chk if not even number appendLastIfNotEven(){ - if [ "$(expr $(wc -l "$1" | awk '{ print $1 }') % 2)" != 0 ] + if [ "$(( $(wc -l "$1" | awk '{ print $1 }') % 2))" -ne 0 ] then tail -n 1 "$1" >> "$1" fi @@ -163,7 +163,7 @@ appendLastIfNotEven "$TEMPORARYDIR/map" totalChunks=`grep 'chk' $TEMPORARYDIR/map | wc -l` temp="$totalChunks" timesRan=0 -while [ $temp != 1 ] +while [ $temp -ne 1 ] do temp=`expr $temp / 2` timesRan=`expr $timesRan + 1` @@ -173,7 +173,7 @@ printf "Total chunks %s \n" "$totalChunks" workingIndex="$TEMPORARYDIR/map" c=$timesRan -while [ "$c" != 0 ] +while [ $c -ne 0 ] do a=1 printf "Level: %s, will work on %s chunks\n" "$c" "$totalChunks" diff --git a/config.sh b/config.sh index aa5bf4b..f10127f 100755 --- a/config.sh +++ b/config.sh @@ -1,9 +1,10 @@ -export AK_IPFS="$(which ipfs)" export AK_ROOT=$HOME export AK_WORKDIR="$AK_ROOT/.arching-kaos" export AK_CONFIGDIR="$AK_WORKDIR/config" export AK_BINDIR="$AK_WORKDIR/bin" export AK_LIBDIR="$AK_WORKDIR/lib" +export PATH=$PATH:$AK_BINDIR +export AK_IPFS="$(which ipfs)" export AK_MODULESDIR="$AK_WORKDIR/modules" export AK_ZBLOCKDIR="$AK_WORKDIR/zblocks" export AK_BLOCKDIR="$AK_WORKDIR/blocks" -- cgit v1.2.3