diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-09-21 18:12:10 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-09-21 18:12:10 +0300 |
commit | 2ec4b6abff5a60f6475eb095121da5819b55fdff (patch) | |
tree | 14552a298deaea2aa48ba76087429e5ca695af11 /lib | |
parent | 7ca336fe23ffa5a194f1c8316b8d4d6d36615b7e (diff) | |
download | arching-kaos-tools-2ec4b6abff5a60f6475eb095121da5819b55fdff.tar.gz arching-kaos-tools-2ec4b6abff5a60f6475eb095121da5819b55fdff.tar.bz2 arching-kaos-tools-2ec4b6abff5a60f6475eb095121da5819b55fdff.zip |
More bug fixing
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/_ak_zchain | 25 |
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)" |