install-maven.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/usr/bin/env bash
  2. # Licensed to the Apache Software Foundation (ASF) under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. The ASF licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. if [ $# -lt 1 ]; then
  18. echo "ERROR: Need at least 1 argument, $# were provided"
  19. exit 1
  20. fi
  21. pkg-resolver/check_platform.py "$1"
  22. if [ $? -eq 1 ]; then
  23. echo "ERROR: Unsupported platform $1"
  24. exit 1
  25. fi
  26. default_version="3.6.3"
  27. version_to_install=$default_version
  28. if [ -n "$2" ]; then
  29. version_to_install="$2"
  30. fi
  31. if [ "$version_to_install" != "3.6.3" ]; then
  32. echo "WARN: Don't know how to install version $version_to_install, installing the default version $default_version instead"
  33. version_to_install=$default_version
  34. fi
  35. if [ "$version_to_install" == "3.6.3" ]; then
  36. mkdir -p /opt/maven /tmp/maven &&
  37. curl -L -s -S https://mirrors.estointernet.in/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz \
  38. -o /tmp/maven/apache-maven-3.6.3-bin.tar.gz &&
  39. tar xzf /tmp/maven/apache-maven-3.6.3-bin.tar.gz --strip-components 1 -C /opt/maven
  40. else
  41. echo "ERROR: Don't know how to install version $version_to_install"
  42. exit 1
  43. fi