From 8240bd9106a4c3a019a70340b7709a13a9e7e8f4 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Sun, 20 Aug 2023 13:24:44 +0300 Subject: Check if there is already a zchain key in IPFS --- init.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3