aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfig.sh1
-rwxr-xr-xinstall.sh1
-rwxr-xr-xlib/_ak_zblock10
3 files changed, 9 insertions, 3 deletions
diff --git a/config.sh b/config.sh
index c8ac722..5ab332a 100755
--- a/config.sh
+++ b/config.sh
@@ -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)"
diff --git a/install.sh b/install.sh
index 4d86c4d..d90db3e 100755
--- a/install.sh
+++ b/install.sh
@@ -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"