From 9606644a0beb4f2883e1e0f4c6c81b42ab40b3a1 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Mon, 3 Apr 2023 00:24:49 +0300 Subject: Renaming to prefix convention, introduced ipfs wrappers so it can be easier to maintain, changes in filesplitter and filejoiner as they move sm submodule namespace... like there are namespaces in bash or something --- bin/ak-zblock-manipulator | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'bin/ak-zblock-manipulator') diff --git a/bin/ak-zblock-manipulator b/bin/ak-zblock-manipulator index 6570484..0076fa1 100755 --- a/bin/ak-zblock-manipulator +++ b/bin/ak-zblock-manipulator @@ -45,22 +45,22 @@ main(){ ak-logthis "We are doing" $BLOCK_TO_ADD "with content" $PREVIOUS # We add it to IPFS - MESSAGE_HASH=$(ipfs add -q $MESSAGE) + MESSAGE_HASH=$(ak-ipfs-add $MESSAGE) # We create a detached and armor signature of it MESSAGE_SIGN_FILE=$MESSAGE".asc" gpg2 --detach-sign --sign-with $FINGERPRINT --armor --output $MESSAGE_SIGN_FILE $MESSAGE # We add the signature to IPFS - MESSAGE_SIGNATURE=$(ipfs add -q $MESSAGE_SIGN_FILE) + MESSAGE_SIGNATURE=$(ak-ipfs-add $MESSAGE_SIGN_FILE) # We will be using our public key also to put it in the block later KEY="gpg.pub" gpg2 --armour --output $KEY --export $FINGERPRINT - GPG_PUB_KEY=$(ipfs add -q $KEY) + GPG_PUB_KEY=$(ak-ipfs-add $KEY) # Acquire last block of information, to chain this one with previous posted - PREVIOUS=$(ipfs files stat /zlatest | head -n 1) + PREVIOUS=$(ak-ipfs-files-stat /zlatest | head -n 1) # We create a block of json like this: cat > block < zblock << EOF @@ -95,7 +95,7 @@ makeZBlock(){ EOF ZBL="zblock" # and we add it on IPFS - ZBLOCK=$(ipfs add -q $ZBL) + ZBLOCK=$(ak-ipfs-add $ZBL) echo $ZBLOCK } @@ -108,11 +108,11 @@ then # We ask for a ZBLOCK or GENESIS to put in the BLOCK PREVIOUS="$2" - ipfs cat "$BLOCK_TO_ADD" + ak-ipfs-cat "$BLOCK_TO_ADD" if [ "$?" == 0 ]; then echo "Nice! We found the block" - ipfs get "$BLOCK_TO_ADD" + ak-ipfs-get "$BLOCK_TO_ADD" sed -i.bak -e 's/^.*previous.*$/\"previous\":\"'$PREVIOUS'\"/' $BLOCK_TO_ADD cat $BLOCK_TO_ADD | jq -M @@ -128,11 +128,11 @@ then # python send_as_ak_tx $ZBLOCK # or for "offline" use echo $ZBLOCK > $ZLATEST - ipfs name publish --key=zchain $ZBLOCK > /dev/null 2>&1 - ipfs files mkdir /zarchive > /dev/null 2>&1 - ipfs files cp /zlatest /zarchive/$(date -u +%s)-$(ipfs files stat /zlatest | head -n 1) > /dev/null 2>&1 - ipfs files rm /zlatest > /dev/null 2>&1 - ipfs files cp /ipfs/$ZBLOCK /zlatest > /dev/null 2>&1 + ak-ipfs-name-publish --key=zchain $ZBLOCK > /dev/null 2>&1 + ak-ipfs-files-mkdir /zarchive > /dev/null 2>&1 + ak-ipfs-files-cp /zlatest /zarchive/$(date -u +%s)-$(ak-ipfs-files-stat /zlatest | head -n 1) > /dev/null 2>&1 + ak-ipfs-files-rm /zlatest > /dev/null 2>&1 + ak-ipfs-files-cp /ipfs/$ZBLOCK /zlatest > /dev/null 2>&1 else usage exit 0 -- cgit v1.2.3