diff options
Diffstat (limited to 'lib/_ak_zblock')
-rwxr-xr-x | lib/_ak_zblock | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/_ak_zblock b/lib/_ak_zblock index 667bf80..9d38711 100755 --- a/lib/_ak_zblock +++ b/lib/_ak_zblock @@ -615,6 +615,8 @@ function _ak_zblock_repack(){ # Optional or extending with # python send_as_ak_tx $ZBLOCK # or for "offline" use + archivaltime="$(date -u +%s)" + echo "${archivaltime} $(cat $AK_ZLATEST)" >> $AK_ZLATEST_HISTORY echo $ZBLOCK > $AK_ZLATEST _ak_ipfs_name_publish zchain /ipfs/$ZBLOCK #> /dev/null 2>&1 if [ $? -ne 0 ] @@ -633,7 +635,7 @@ function _ak_zblock_repack(){ 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/${archivaltime}-$(_ak_ipfs_files_stat /zlatest | head -n 1) > /dev/null 2>&1 if [ $? -ne 0 ] then _ak_log_error "Could not back up previous /zlatest" @@ -691,7 +693,7 @@ function _ak_zblock_pack(){ _ak_gpg_key_self_export $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="$(cat $AK_ZLATEST)" # 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 BLOCK="block" @@ -716,6 +718,8 @@ function _ak_zblock_pack(){ # Optional or extending with # python send_as_ak_tx $ZBLOCK # or for "offline" use + archivaltime="$(date -u +%s)" + echo "${archivaltime} $(cat $AK_ZLATEST)" >> $AK_ZLATEST_HISTORY echo $ZBLOCK > $AK_ZLATEST _ak_ipfs_name_publish zchain /ipfs/$ZBLOCK > /dev/null 2>&1 if [ $? -ne 0 ] @@ -734,7 +738,7 @@ function _ak_zblock_pack(){ 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/${archivaltime}-$(_ak_ipfs_files_stat /zlatest | head -n 1) > /dev/null 2>&1 if [ $? -ne 0 ] then _ak_log_error "Could not back up previous /zlatest" |