From 465d5db06e56dc21072a8ff01258f6815d340b00 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Wed, 27 Mar 2024 09:34:01 +0200 Subject: new lib _ak_ipfs --- bin/ak-zblock-pack | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'bin/ak-zblock-pack') diff --git a/bin/ak-zblock-pack b/bin/ak-zblock-pack index 4f635bf..f5b6505 100755 --- a/bin/ak-zblock-pack +++ b/bin/ak-zblock-pack @@ -54,22 +54,22 @@ main(){ logit "INFO" "We are doing $ACTION with content $MESSAGE" # We add it to IPFS - MESSAGE_HASH=$(ak-ipfs-add $MESSAGE) + MESSAGE_HASH=$(_ak_ipfs_add $MESSAGE) # We create a detached and armor signature of it MESSAGE_SIGN_FILE=$MESSAGE".asc" _ak_gpg_sign_detached $MESSAGE_SIGN_FILE $MESSAGE # We add the signature to IPFS - MESSAGE_SIGNATURE=$(ak-ipfs-add $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" _ak_gpg_key_self_export $KEY - GPG_PUB_KEY=$(ak-ipfs-add $KEY) + GPG_PUB_KEY=$(_ak_ipfs_add $KEY) # Acquire last block of information, to chain this one with previous posted - PREVIOUS=$(ak-ipfs-files-stat /zlatest | head -n 1) + PREVIOUS=$(_ak_ipfs_files_stat /zlatest | head -n 1) # We create a block of json like this: printf '{"timestamp":"%s","action":"%s","data":"%s","detach":"%s","gpg":"%s","previous":"%s"}' $(date -u +%s) $ACTION $MESSAGE_HASH $MESSAGE_SIGNATURE $GPG_PUB_KEY $PREVIOUS > block @@ -79,16 +79,16 @@ main(){ _ak_gpg_sign_detached $BLOCK_SIG $BLOCK # We now add the signature to IPFS - BLOCK_SIGNATURE=$(ak-ipfs-add $BLOCK_SIG) + BLOCK_SIGNATURE=$(_ak_ipfs_add $BLOCK_SIG) # We also add the block! - BLOCK=$(ak-ipfs-add $BLOCK) + BLOCK=$(_ak_ipfs_add $BLOCK) # So we now do the think almost again printf '{"block":"%s","block_signature":"%s"}' $BLOCK $BLOCK_SIGNATURE > zblock ZBL="zblock" # and we add it on IPFS - ZBLOCK=$(ak-ipfs-add $ZBL) + ZBLOCK=$(_ak_ipfs_add $ZBL) echo $ZBLOCK } @@ -108,36 +108,36 @@ then # python send_as_ak_tx $ZBLOCK # or for "offline" use echo $ZBLOCK > $AK_ZLATEST - ak-ipfs-name-publish --key=zchain $ZBLOCK > /dev/null 2>&1 + _ak_ipfs_name_publish --key=zchain $ZBLOCK > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "ERROR" "Failed publishing ZBLOCK: $ZBLOCK" exit 1 fi - ak-ipfs-files-ls /zarchive > /dev/null 2>&1 + _ak_ipfs_files_ls /zarchive > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "WARNING" "/zarchive does not exist" - ak-ipfs-files-mkdir /zarchive > /dev/null 2>&1 + _ak_ipfs_files_mkdir /zarchive > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "ERROR" "Could not create /zarchive directory. Aborting." exit 1 fi fi - ak-ipfs-files-cp /zlatest /zarchive/$(date -u +%s)-$(ak-ipfs-files-stat /zlatest | head -n 1) > /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 if [ "$?" -ne 0 ] then logit "ERROR" "Could not back up previous /zlatest" exit 1 fi - ak-ipfs-files-rm /zlatest > /dev/null 2>&1 + _ak_ipfs_files_rm /zlatest > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "ERROR" "Could not remove previous /zlatest" exit 1 fi - ak-ipfs-files-cp /ipfs/$ZBLOCK /zlatest > /dev/null 2>&1 + _ak_ipfs_files_cp /ipfs/$ZBLOCK /zlatest > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "ERROR" "Could not copy $ZBLOCK to /zlatest" -- cgit v1.2.3