diff options
| author | kaotisk <kaotisk@arching-kaos.org> | 2025-03-08 17:08:37 +0200 | 
|---|---|---|
| committer | kaotisk <kaotisk@arching-kaos.org> | 2025-03-08 17:08:37 +0200 | 
| commit | 5b9d80959bdfab7fedb7a307d324811ba49b6aa5 (patch) | |
| tree | 5cf67f1438ec950fafd15671e3db6248e77ac470 | |
| parent | 2b75c088b3fcc46c0bedb3beb1eba96ab086a023 (diff) | |
| download | arching-kaos-tools-5b9d80959bdfab7fedb7a307d324811ba49b6aa5.tar.gz arching-kaos-tools-5b9d80959bdfab7fedb7a307d324811ba49b6aa5.tar.bz2 arching-kaos-tools-5b9d80959bdfab7fedb7a307d324811ba49b6aa5.zip  | |
Keeping history of published ZBLOCKs outside IPFS
| -rwxr-xr-x | config.sh | 1 | ||||
| -rwxr-xr-x | install.sh | 1 | ||||
| -rwxr-xr-x | lib/_ak_zblock | 10 | 
3 files changed, 9 insertions, 3 deletions
@@ -31,6 +31,7 @@ export AK_CACHEDIR="$AK_WORKDIR/cache"  export AK_CHUNKSDIR="$AK_WORKDIR/akfs/chunks"  export AK_LEAFSDIR="$AK_WORKDIR/akfs/leafs"  export AK_MAPSDIR="$AK_WORKDIR/akfs/maps" +export AK_ZLATEST_HISTORY="$AK_WORKDIR/zlatest_history"  #source $AK_LIBDIR/_ak_settings  #export AK_FINGERPRINT="$(_ak_settings_get gpg.fingerprint)" @@ -120,6 +120,7 @@ _ak_check_and_create_dir $AK_LEAFSDIR  _ak_check_and_create_dir $AK_MAPSDIR  _ak_check_and_create_dir $AK_GPGHOME  chmod 700 $AK_GPGHOME +_ak_let_there_be_file $AK_ZLATEST_HISTORY  _ak_let_there_be_file $AK_GENESIS  _ak_let_there_be_file $AK_ZBLOCKSFILE  _ak_let_there_be_file $AK_ZPAIRSFILE 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"  | 
