From be6fabec348c7a3b7a096a2cfd0d38bc9bf25d28 Mon Sep 17 00:00:00 2001 From: Pratik Patil Date: Fri, 25 Nov 2022 16:07:18 +0530 Subject: [PATCH 1/2] fixed static-nodes related buf (os independent) --- scripts/getconfig.go | 2 +- scripts/getconfig.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/getconfig.go b/scripts/getconfig.go index caf3f45a8e..7fbd39ac6d 100644 --- a/scripts/getconfig.go +++ b/scripts/getconfig.go @@ -375,7 +375,7 @@ func getStaticTrustedNodes(args []string) { fmt.Println("only TOML config file is supported through CLI") } } else { - path := "~/.bor/data/bor/static-nodes.json" + path := "./static-nodes.json" if !checkFileExists(path) { return } diff --git a/scripts/getconfig.sh b/scripts/getconfig.sh index a2971c4f12..add8908b66 100755 --- a/scripts/getconfig.sh +++ b/scripts/getconfig.sh @@ -43,6 +43,11 @@ cleanup() { } trap cleanup EXIT INT QUIT TERM +if [[ -f $HOME/.bor/data/bor/static-nodes.json ]] +then +cp $HOME/.bor/data/bor/static-nodes.json ./static-nodes.json +fi + # SHA1 hash of `tempStart` -> `3305fe263dd4a999d58f96deb064e21bb70123d9` sed 's/bor --/go run getconfig.go notYet --/g' $startPath > $tmpDir/3305fe263dd4a999d58f96deb064e21bb70123d9.sh chmod +x $tmpDir/3305fe263dd4a999d58f96deb064e21bb70123d9.sh @@ -113,4 +118,9 @@ chmod +x $tmpDir/3305fe263dd4a999d58f96deb064e21bb70123d9.sh $tmpDir/3305fe263dd4a999d58f96deb064e21bb70123d9.sh $ADD rm $tmpDir/3305fe263dd4a999d58f96deb064e21bb70123d9.sh +if [[ -f $HOME/.bor/data/bor/static-nodes.json ]] +then +rm ./static-nodes.json +fi + exit 0 From a7843f93a91ff2f34614590d272b90f032c52cf9 Mon Sep 17 00:00:00 2001 From: Pratik Patil Date: Fri, 25 Nov 2022 16:56:25 +0530 Subject: [PATCH 2/2] taking static-nodes as input if default not present --- scripts/getconfig.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/getconfig.sh b/scripts/getconfig.sh index add8908b66..472af08802 100755 --- a/scripts/getconfig.sh +++ b/scripts/getconfig.sh @@ -24,6 +24,14 @@ then fi read -p "* Your validator address (e.g. 0xca67a8D767e45056DC92384b488E9Af654d78DE2), or press Enter to skip if running a sentry node: " ADD +if [[ -f $HOME/.bor/data/bor/static-nodes.json ]] +then +cp $HOME/.bor/data/bor/static-nodes.json ./static-nodes.json +else +read -p "* You dont have '~/.bor/data/bor/static-nodes.json' file. If you want to use static nodes, enter the path to 'static-nodes.json' here (press Enter to skip): " STAT +if [[ -f $STAT ]]; then cp $STAT ./static-nodes.json; fi +fi + printf "\nThank you, your inputs are:\n" echo "Path to start.sh: "$startPath echo "Address: "$ADD @@ -43,11 +51,6 @@ cleanup() { } trap cleanup EXIT INT QUIT TERM -if [[ -f $HOME/.bor/data/bor/static-nodes.json ]] -then -cp $HOME/.bor/data/bor/static-nodes.json ./static-nodes.json -fi - # SHA1 hash of `tempStart` -> `3305fe263dd4a999d58f96deb064e21bb70123d9` sed 's/bor --/go run getconfig.go notYet --/g' $startPath > $tmpDir/3305fe263dd4a999d58f96deb064e21bb70123d9.sh chmod +x $tmpDir/3305fe263dd4a999d58f96deb064e21bb70123d9.sh