From bc68fbb63620adbcc36aa0008a43cba966d391c7 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 7 Jan 2019 06:37:15 -0500 Subject: [PATCH] use temp file for lokinet-bootstrap --- lokinet-bootstrap | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lokinet-bootstrap b/lokinet-bootstrap index d13a4983e..094014362 100755 --- a/lokinet-bootstrap +++ b/lokinet-bootstrap @@ -20,6 +20,12 @@ then mkdir $HOME/.lokinet fi +# use temp file to not overrwrite existing bootstrap file on fail +tmp=mktemp + # MacOS does not have wget without homebrew but does have curl # Rick also had indicated most BSDs have curl too -curl "$url" > $HOME/.lokinet/bootstrap.signed; echo -e "${GREEN}lokinet successfully bootstrapped${NC}" || echo -e "${RED}failed to download bootstrap from $url${NC}" +curl "$url" > "$tmp" && \ + (mv "$tmp" "$HOME/.lokinet/bootstrap.signed" && echo -e "${GREEN}lokinet successfully bootstrapped${NC}" ) \ + || echo -e "${RED}failed to download bootstrap from $url${NC}" +rm -f "$tmp"