install.sh 897 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/sh
  2. set -e -x -u
  3. if [ -z "$1" ]
  4. then
  5. echo "version is empty."
  6. exit 5
  7. fi
  8. url="https://www.taosdata.com/download/download-all.php?pkgType=tdengine_linux&pkgName=TDengine-client-$1-Linux-x64.tar.gz"
  9. if [ "$(uname -m)" = "aarch64" ]; then \
  10. url="https://www.taosdata.com/download/download-all.php?pkgType=tdengine_linux&pkgName=TDengine-client-$1-Linux-aarch64.tar.gz"
  11. fi
  12. zip="TDengine-client.tar.gz"
  13. wget -T 280 -O "$zip" "$url"
  14. if ! [ -e $zip ]
  15. then
  16. echo "Not downloaded to the installation package."
  17. exit 2
  18. fi
  19. dir="TDengine-client"
  20. mkdir "$dir"
  21. tar -xzvf "$zip" -C ./"$dir" --strip-components 1
  22. rm "$zip"
  23. if ! [ -e $dir ]
  24. then
  25. echo "Failed to decompress Taos client."
  26. exit 3
  27. fi
  28. cd "$dir"
  29. ret=""
  30. for file in ./*
  31. do
  32. if [ -x $file -a ! -d $file ]
  33. then
  34. ./"$file"
  35. ret="successful"
  36. fi
  37. done
  38. cd ../
  39. rm -rf "$dir"
  40. if [ -z "$ret" ]
  41. then
  42. echo "not found script."
  43. exit 4
  44. fi