03.install_tools_jmeter.sh 994 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. # fail if any commands fails
  3. set -e
  4. # debug log
  5. #set -x
  6. # Set superuser privileges command if not set
  7. if [[ -z $su ]]; then
  8. export su="sudo"
  9. fi
  10. #https://jmeter.apache.org/download_jmeter
  11. $su apt-get update -qq
  12. $su apt-get install -qq -y curl
  13. mkdir -p ~/bin
  14. cd ~/bin || return
  15. export JMETER_VERSION=$(curl --silent "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=jmeter" | grep "pkgver=" | sed 's/pkgver=//')
  16. export JMETER_HOME=$HOME/bin/apache-jmeter-${JMETER_VERSION}
  17. export JMETER_BIN="${JMETER_HOME}"/bin
  18. export JMETER_DOWNLOAD_URL="https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-${JMETER_VERSION}.tgz"
  19. # Remove previous file
  20. rm -rf apache-jmeter-*.tgz
  21. # Download new version
  22. curl -OL "${JMETER_DOWNLOAD_URL}"
  23. # Remove previous directory
  24. rm -rf apache-jmeter-"${JMETER_VERSION}"
  25. # Remove previous symlink
  26. rm -f jmeter
  27. # Extract new version
  28. tar -xzf apache-jmeter-"${JMETER_VERSION}".tgz
  29. # Create new symlink
  30. ln -s "$JMETER_BIN"/jmeter "$HOME"/bin/