From fc91066907e4d16a951c8d72d23aa610945f5407 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Mon, 3 Apr 2023 05:15:00 +0300 Subject: Clean up, elimination of duplicate tempassins, fixed current directory problems, introduced new tool --- bin/ak-enter | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'bin/ak-enter') diff --git a/bin/ak-enter b/bin/ak-enter index dd65dcf..45fcace 100755 --- a/bin/ak-enter +++ b/bin/ak-enter @@ -75,8 +75,7 @@ seed="$(cat $AK_ZGENESIS)" zblock="$entrance" # Enter temp folder -TEMPASSIN="/tmp/aktmp_$(date -u +%s)" -mkdir $TEMPASSIN +TEMPASSIN="$(ak-tempassin)" cd $TEMPASSIN counter=0 # The loop @@ -123,12 +122,12 @@ do logit "[INFO]" "ZBLOCK $zblock is JSON" # Then we pass it through the filter and save it - ak-ipfs-cat $zblock | ak-json2bash > $TEMPASSIN/tmp-zblock + ak-ipfs-cat $zblock | ak-json2bash > tmp-zblock # Be sure that there are the expected values # We need 'block' and 'block_signature' inside a 'zblock' # Exit if any is missing - grep -e 'block_signature' $TEMPASSIN/tmp-zblock > /dev/null 2>&1 + grep -e 'block_signature' tmp-zblock > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "[ERROR]" "ZBLOCK $zblock doesn't contain a block_signature" @@ -136,7 +135,7 @@ do fi logit "[INFO]" "ZBLOCK $zblock contains a block_signature" - grep -e 'block=' $TEMPASSIN/tmp-zblock > /dev/null 2>&1 + grep -e 'block=' tmp-zblock > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "[ERROR]" "ZBLOCK $zblock has no block" @@ -153,20 +152,20 @@ do # access to your chain, I would consider mild secure to source # the files into your bash. # File an issue/pull request if you think it can be done better!! - source $TEMPASSIN/tmp-zblock + source tmp-zblock logit "[INFO]" "ZBLOCK SOURCED" # Same as above applies to BLOCK and DATA subparts of each ZBLOCK # BLOCKS echo -n '"block":"'$block'",' - ak-ipfs-cat $block | ak-json2bash > $TEMPASSIN/tmp-block + ak-ipfs-cat $block | ak-json2bash > tmp-block if [ "$?" -ne 0 ] then logit "[ERROR]" "BLOCK $block READ failed" exit 1 fi - grep -e 'timestamp' -e 'gpg' -e 'data' -e 'action' -e 'detach' -e 'previous' $TEMPASSIN/tmp-block > /dev/null 2>&1 + grep -e 'timestamp' -e 'gpg' -e 'data' -e 'action' -e 'detach' -e 'previous' tmp-block > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "[ERROR]" "BLOCK $block is NOT a valid block" @@ -174,7 +173,7 @@ do fi logit "[INFO]" "BLOCK $block is a block" - source $TEMPASSIN/tmp-block + source tmp-block logit "[INFO]" "BLOCK $block SOURCED" touch $BLOCKDIR/$block logit "[INFO]" "BLOCK REFERENCED" -- cgit v1.2.3