aboutsummaryrefslogtreecommitdiff
path: root/lib/_ak_zchain
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-09-21 18:12:10 +0300
committerkaotisk <kaotisk@arching-kaos.org>2024-09-21 18:12:10 +0300
commit2ec4b6abff5a60f6475eb095121da5819b55fdff (patch)
tree14552a298deaea2aa48ba76087429e5ca695af11 /lib/_ak_zchain
parent7ca336fe23ffa5a194f1c8316b8d4d6d36615b7e (diff)
downloadarching-kaos-tools-2ec4b6abff5a60f6475eb095121da5819b55fdff.tar.gz
arching-kaos-tools-2ec4b6abff5a60f6475eb095121da5819b55fdff.tar.bz2
arching-kaos-tools-2ec4b6abff5a60f6475eb095121da5819b55fdff.zip
More bug fixing
Diffstat (limited to 'lib/_ak_zchain')
-rwxr-xr-xlib/_ak_zchain25
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/_ak_zchain b/lib/_ak_zchain
index c7b6c2e..341cb6c 100755
--- a/lib/_ak_zchain
+++ b/lib/_ak_zchain
@@ -10,16 +10,23 @@ _ak_zchain_reset(){
if [ $? != 0 ]; then exit 1; fi
echo "Make sure /zarchive folder exists within IPFS FS"
- _ak_ipfs_files_mkdir /zarchive
- if [ $? != 0 ]; then echo "Folder already there"; fi
-
- echo "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
+ _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
+ fi
- echo "Removing previous /zlatest entry"
- _ak_ipfs_files_rm /zlatest
- if [ $? != 0 ]; then exit 1; fi
+ _ak_ipfs_files_stat /zlatest
+ if [ $? -eq 0 ]
+ then
+ echo "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"
+ _ak_ipfs_files_rm /zlatest
+ if [ $? != 0 ]; then exit 1; fi
+ fi
echo "Copying reset AK_ZLATEST"
CZLATEST="$(cat $AK_ZLATEST)"