aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-09-21 18:26:33 +0300
committerkaotisk <kaotisk@arching-kaos.org>2024-09-21 18:26:33 +0300
commit8abba3564e8ecc5ec01aa24682c6618cd285b4fe (patch)
tree79ce7c470dd6802fedbf7b13e40299d479d32045 /lib
parent2ec4b6abff5a60f6475eb095121da5819b55fdff (diff)
downloadarching-kaos-tools-8abba3564e8ecc5ec01aa24682c6618cd285b4fe.tar.gz
arching-kaos-tools-8abba3564e8ecc5ec01aa24682c6618cd285b4fe.tar.bz2
arching-kaos-tools-8abba3564e8ecc5ec01aa24682c6618cd285b4fe.zip
Bug fixing
Diffstat (limited to 'lib')
-rwxr-xr-xlib/_ak_zchain48
1 files changed, 36 insertions, 12 deletions
diff --git a/lib/_ak_zchain b/lib/_ak_zchain
index 341cb6c..8a5755b 100755
--- a/lib/_ak_zchain
+++ b/lib/_ak_zchain
@@ -5,37 +5,61 @@ source $AK_LIBDIR/_ak_zblock
source $AK_LIBDIR/_ak_script
_ak_zchain_reset(){
- echo "Reseting AK_ZLATEST to AK_ZGENESIS"
+ _ak_log_info "Reseting AK_ZLATEST to AK_ZGENESIS"
cp $AK_ZGENESIS $AK_ZLATEST
- if [ $? != 0 ]; then exit 1; fi
+ if [ $? -ne 0 ]
+ then
+ _ak_log_error "Failed to reset AK_ZLATEST to AK_ZGENESIS"
+ exit 1
+ fi
- echo "Make sure /zarchive folder exists within IPFS FS"
+ _ak_log_info "Make sure /zarchive folder exists within IPFS FS"
_ak_ipfs_files_stat /zarchive
if [ $? -ne 0 ]
then
_ak_ipfs_files_mkdir /zarchive
- if [ $? -ne 0 ]; then echo "Could not create directory /zarchive"; fi
+ if [ $? -ne 0 ]
+ then
+ _ak_log_error "Could not create directory /zarchive"
+ exit 1
+ fi
fi
_ak_ipfs_files_stat /zlatest
if [ $? -eq 0 ]
then
- echo "Archive the previous AK_ZLATEST"
+ _ak_log_info "Archive the previous AK_ZLATEST"
_ak_ipfs_files_cp /zlatest /zarchive/$(date -u +%s)-$(_ak_ipfs_files_stat /zlatest | head -n 1)
- if [ $? != 0 ]; then exit 1; fi
- echo "Removing previous /zlatest entry"
+ if [ $? -ne 0 ]
+ then
+ _ak_log_error "Failed to copy /zlatest to /zarchive"
+ exit 1
+ fi
+ _ak_log_info "Removing previous /zlatest entry"
_ak_ipfs_files_rm /zlatest
- if [ $? != 0 ]; then exit 1; fi
+ if [ $? -ne 0 ]
+ then
+ _ak_log_error "Failed to remove /zlatest"
+ exit 1
+ fi
fi
- echo "Copying reset AK_ZLATEST"
+ _ak_log_info "Copying reset AK_ZLATEST"
CZLATEST="$(cat $AK_ZLATEST)"
_ak_ipfs_files_cp /ipfs/$CZLATEST /zlatest
- if [ $? != 0 ]; then exit 1; fi
+ if [ $? -ne 0 ]
+ then
+ _ak_log_error "Failed to copy AK_ZLATEST to /zlatest"
+ exit 1
+ fi
- echo "Publishing new (reset) AK_ZLATEST"
+ _ak_log_info "Publishing new (reset) AK_ZLATEST"
_ak_ipfs_name_publish --key=zchain /ipfs/$(cat $AK_ZLATEST)
- if [ $? != 0 ]; then exit 1; fi
+ if [ $? -ne 0 ]
+ then
+ _ak_log_error "Failed to publish updated zchain"
+ exit 1
+ fi
_ak_config_publish
if [ $? -ne 0 ]