set-hdp-repo-url.sh 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/sh
  2. #
  3. # Licensed to the Apache Software Foundation (ASF) under one
  4. # or more contributor license agreements. See the NOTICE file
  5. # distributed with this work for additional information
  6. # regarding copyright ownership. The ASF licenses this file
  7. # to you under the Apache License, Version 2.0 (the
  8. # "License"); you may not use this file except in compliance
  9. # with the License. You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing,
  14. # software distributed under the License is distributed on an
  15. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. # KIND, either express or implied. See the License for the
  17. # specific language governing permissions and limitations
  18. # under the License.
  19. #
  20. if [ "$1" != '${hdpUrlForCentos6}' ]
  21. then
  22. # Updating for new stack version:
  23. # Create the new stack definition with parameterized repoinfo.xml files.
  24. # Typically, copying the files from the previous version will work.
  25. # Modify the VERSION variable in this file to match the new version
  26. # Modify the previous version to store concrete public repo url
  27. VERSION=2.1
  28. C6URL="$1"
  29. LATEST_URL="$2"
  30. C5URL="${C6URL/centos6/centos5}"
  31. S11URL="${C6URL/centos6/suse11}"
  32. U12URL="${C6URL/centos6/ubuntu12}"
  33. if [ "$#" != 3 ]
  34. then
  35. HDPREPO=target/classes/stacks/HDP/${VERSION}/repos
  36. else
  37. HDPREPO=$3/var/lib/ambari-server/resources/stacks/HDP/${VERSION}/repos
  38. fi
  39. echo "Processing '${HDPREPO}/repoinfo.xml' and '${HDPLOCALREPO}/repoinfo.xml'"
  40. echo "$3"
  41. echo "Setting centos5 stack url to '$C5URL'"
  42. sed "s;REPLACE_WITH_CENTOS5_URL;$C5URL;" ${HDPREPO}/repoinfo.xml > ${HDPREPO}/repoinfo.xml.tmp; mv ${HDPREPO}/repoinfo.xml.tmp ${HDPREPO}/repoinfo.xml
  43. echo "Setting centos6 stack url to '$C6URL'"
  44. sed "s;REPLACE_WITH_CENTOS6_URL;$C6URL;" ${HDPREPO}/repoinfo.xml > ${HDPREPO}/repoinfo.xml.tmp; mv ${HDPREPO}/repoinfo.xml.tmp ${HDPREPO}/repoinfo.xml
  45. echo "Setting suse11 stack url to '$S11URL'"
  46. sed "s;REPLACE_WITH_SUSE11_URL;$S11URL;" ${HDPREPO}/repoinfo.xml > ${HDPREPO}/repoinfo.xml.tmp; mv ${HDPREPO}/repoinfo.xml.tmp ${HDPREPO}/repoinfo.xml
  47. echo "Setting ubuntu12 stack url to '$U12URL'"
  48. sed "s;REPLACE_WITH_UBUNTU12_URL;$U12URL;" ${HDPREPO}/repoinfo.xml > ${HDPREPO}/repoinfo.xml.tmp; mv ${HDPREPO}/repoinfo.xml.tmp ${HDPREPO}/repoinfo.xml
  49. # all stacks get the same url
  50. for ver in '1.3' '2.0' '2.1' '2.2'; do
  51. echo "Replacing $ver latest lookup url to '$LATEST_URL'"
  52. HDPREPO=target/classes/stacks/HDP/$ver/repos
  53. sed "s;\(<latest>\)\([^>]*\)\(<\/latest>\);\1$LATEST_URL\3;" ${HDPREPO}/repoinfo.xml > ${HDPREPO}/repoinfo.xml.tmp; mv ${HDPREPO}/repoinfo.xml.tmp ${HDPREPO}/repoinfo.xml
  54. done
  55. fi