From 29a20abba5e4d2a04f4df03b0a339f1557dbfc8b Mon Sep 17 00:00:00 2001 From: pete1019 <56532989+pete1019@users.noreply.github.com> Date: Sun, 31 Oct 2021 18:18:07 +0100 Subject: [PATCH] check if files exists, if not get from latest --- scripts/netclient-install.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/netclient-install.sh b/scripts/netclient-install.sh index a9c6341f..2b66c9a3 100755 --- a/scripts/netclient-install.sh +++ b/scripts/netclient-install.sh @@ -92,7 +92,14 @@ esac echo "Binary = $dist" -wget -nv -O netclient https://github.com/gravitl/netmaker/releases/download/$VERSION/$dist +url="https://github.com/gravitl/netmaker/releases/download/$VERSION/$dist" +if curl --output /dev/null --silent --head --fail "$url"; then + echo "Downloading $dist $VERSION" + wget -nv -O netclient $url +else + echo "Downloading $dist latest" + wget -nv -O netclient https://github.com/gravitl/netmaker/releases/download/latest/$dist +fi chmod +x netclient sudo ./netclient join -t $KEY rm -f netclient