ソースを参照

check if files exists, if not get from latest

pete1019 3 年 前
コミット
29a20abba5
1 ファイル変更8 行追加1 行削除
  1. 8 1
      scripts/netclient-install.sh

+ 8 - 1
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