install.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/sh
  2. #
  3. # Copyright 2021 EMQ Technologies Co., Ltd.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. set -e -x -u
  18. if [ -z "$1" ]
  19. then
  20. echo "version is empty."
  21. exit 5
  22. fi
  23. url="https://www.taosdata.com/assets-download/TDengine-client-$1-Linux-x64.tar.gz"
  24. if [ "$(uname -m)" = "aarch64" ]; then \
  25. url="https://www.taosdata.com/assets-download/TDengine-client-$1-Linux-aarch64.tar.gz"
  26. fi
  27. zip="TDengine-client.tar.gz"
  28. wget -T 280 -O "$zip" "$url"
  29. if ! [ -e $zip ]
  30. then
  31. echo "Not downloaded to the installation package."
  32. exit 2
  33. fi
  34. dir="TDengine-client"
  35. mkdir "$dir"
  36. tar -xzvf "$zip" -C ./"$dir" --strip-components 1
  37. rm "$zip"
  38. if ! [ -e $dir ]
  39. then
  40. echo "Failed to decompress Taos client."
  41. exit 3
  42. fi
  43. cd "$dir"
  44. ret=""
  45. for file in ./*
  46. do
  47. if [ -x $file -a ! -d $file ]
  48. then
  49. ./"$file"
  50. ret="successful"
  51. fi
  52. done
  53. cd ../
  54. rm -rf "$dir"
  55. if [ -z "$ret" ]
  56. then
  57. echo "not found script."
  58. exit 4
  59. fi