netclient-install.sh 817 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. set -e
  3. if [ "$EUID" -ne 0 ]; then
  4. echo "This script must be run as root"
  5. exit 1
  6. fi
  7. [ -z "$KEY" ] && KEY=nokey;
  8. [ -z "$VERSION" ] && echo "no \$VERSION provided, fallback to latest" && VERSION=latest;
  9. dist=netclient
  10. echo "OS Version = $(uname)"
  11. echo "Netclient Version = $VERSION"
  12. if [[ "$(uname)" == "Linux"* ]]; then
  13. arch=$(uname -i)
  14. echo "CPU ARCH = $arch"
  15. if [ "$arch" == 'x86_64' ];
  16. then
  17. dist=netclient
  18. fi
  19. if [ "$arch" == 'x86_32' ];
  20. then
  21. dist=netclient-32
  22. fi
  23. if [ "$arch" == 'armv*' ];
  24. then
  25. dist=netclient-arm64
  26. fi
  27. elif [[ "$(uname)" == "Darwin"* ]]; then
  28. dist=netclient-darwin
  29. fi
  30. echo "Binary = $dist"
  31. wget -O netclient https://github.com/gravitl/netmaker/releases/download/$VERSION/netclient
  32. chmod +x netclient
  33. sudo ./netclient join -t $KEY
  34. rm -f netclient