aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2025-03-08 17:08:37 +0200
committerkaotisk <kaotisk@arching-kaos.org>2025-03-08 17:08:37 +0200
commit5b9d80959bdfab7fedb7a307d324811ba49b6aa5 (patch)
tree5cf67f1438ec950fafd15671e3db6248e77ac470 /lib
parent2b75c088b3fcc46c0bedb3beb1eba96ab086a023 (diff)
downloadarching-kaos-tools-5b9d80959bdfab7fedb7a307d324811ba49b6aa5.tar.gz
arching-kaos-tools-5b9d80959bdfab7fedb7a307d324811ba49b6aa5.tar.bz2
arching-kaos-tools-5b9d80959bdfab7fedb7a307d324811ba49b6aa5.zip
Keeping history of published ZBLOCKs outside IPFS
Diffstat (limited to 'lib')
-rwxr-xr-xlib/_ak_zblock10
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"