aboutsummaryrefslogtreecommitdiff
path: root/bin/ak-enter
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2023-04-03 05:15:00 +0300
committerkaotisk <kaotisk@arching-kaos.org>2023-04-03 05:15:00 +0300
commitfc91066907e4d16a951c8d72d23aa610945f5407 (patch)
tree8d66ab33ae012ba185810b7462cd58687b6be38b /bin/ak-enter
parentad7d6281475c4adb67e0a43017803aeb4a9059ce (diff)
downloadarching-kaos-tools-fc91066907e4d16a951c8d72d23aa610945f5407.tar.gz
arching-kaos-tools-fc91066907e4d16a951c8d72d23aa610945f5407.tar.bz2
arching-kaos-tools-fc91066907e4d16a951c8d72d23aa610945f5407.zip
Clean up, elimination of duplicate tempassins, fixed current directory problems, introduced new tool
Diffstat (limited to 'bin/ak-enter')
-rwxr-xr-xbin/ak-enter17
1 files changed, 8 insertions, 9 deletions
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"