aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2023-08-20 13:24:44 +0300
committerkaotisk <kaotisk@arching-kaos.org>2023-08-20 13:24:44 +0300
commit8240bd9106a4c3a019a70340b7709a13a9e7e8f4 (patch)
treeec0d7e5751c62b748351d4d3df45566341e85b02
parent925b16d12bc27aba96b9d543485a20a5e25ddbac (diff)
downloadarching-kaos-tools-8240bd9106a4c3a019a70340b7709a13a9e7e8f4.tar.gz
arching-kaos-tools-8240bd9106a4c3a019a70340b7709a13a9e7e8f4.tar.bz2
arching-kaos-tools-8240bd9106a4c3a019a70340b7709a13a9e7e8f4.zip
Check if there is already a zchain key in IPFS
-rwxr-xr-xinit.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/init.sh b/init.sh
index e1c42b1..1334a7e 100755
--- a/init.sh
+++ b/init.sh
@@ -51,7 +51,16 @@ printf "Initialization started... \n"
ak_gpg_check_or_create
if [ -f $AK_ZGENESIS ] ; then printf "%s" "$(ipfs add -q $AK_GENESIS)" > $AK_ZGENESIS;fi
-if [ ! -f $AK_ZCHAIN ] ; then printf "%s" "$(ipfs key gen zchain)" > $AK_ZCHAIN;fi
+if [ ! -f $AK_ZCHAIN ]
+then
+ ipfs key list | grep zchain
+ if [ "$?" -ne 0 ]
+ then
+ printf "%s" "$(ipfs key gen zchain)" > $AK_ZCHAIN
+ else
+ printf "%s" "$(ipfs key list -l | grep zchain | awk '{ print $1 }')" > $AK_ZCHAIN
+ fi
+fi
if [ ! -f $AK_ZLATEST ] ; then cp $AK_ZGENESIS $AK_ZLATEST;fi
if [ ! -f $AK_ZCHAINASC ] ; then gpg2 --homedir $AK_GPGHOME -bao $AK_ZCHAINASC $AK_ZCHAIN;fi
if [ ! -f $AK_ZZCHAIN ] ; then printf "%s" "$(ipfs add -q $AK_ZCHAINASC)" > $AK_ZZCHAIN;fi