set-hdp-repo-url.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. STACKS_DIR=$3/src/main/resources/stacks/HDP/
  34. HDPREPO_DIR=$STACKS_DIR/${VERSION}/repos
  35. echo "Processing '${HDPREPO_DIR}/repoinfo.xml' and '${HDPLOCALREPO}/repoinfo.xml'"
  36. echo "$3"
  37. echo "Setting centos5 stack url to '$C5URL'"
  38. sed "s;REPLACE_WITH_CENTOS5_URL;$C5URL;" ${HDPREPO_DIR}/repoinfo.xml > ${HDPREPO_DIR}/repoinfo.xml.tmp; mv ${HDPREPO_DIR}/repoinfo.xml.tmp ${HDPREPO_DIR}/repoinfo.xml
  39. echo "Setting centos6 stack url to '$C6URL'"
  40. sed "s;REPLACE_WITH_CENTOS6_URL;$C6URL;" ${HDPREPO_DIR}/repoinfo.xml > ${HDPREPO_DIR}/repoinfo.xml.tmp; mv ${HDPREPO_DIR}/repoinfo.xml.tmp ${HDPREPO_DIR}/repoinfo.xml
  41. echo "Setting suse11 stack url to '$S11URL'"
  42. sed "s;REPLACE_WITH_SUSE11_URL;$S11URL;" ${HDPREPO_DIR}/repoinfo.xml > ${HDPREPO_DIR}/repoinfo.xml.tmp; mv ${HDPREPO_DIR}/repoinfo.xml.tmp ${HDPREPO_DIR}/repoinfo.xml
  43. echo "Setting ubuntu12 stack url to '$U12URL'"
  44. sed "s;REPLACE_WITH_UBUNTU12_URL;$U12URL;" ${HDPREPO_DIR}/repoinfo.xml > ${HDPREPO_DIR}/repoinfo.xml.tmp; mv ${HDPREPO_DIR}/repoinfo.xml.tmp ${HDPREPO_DIR}/repoinfo.xml
  45. # all stacks get the same url
  46. for HDP_VERSION_DIR in $(find $STACKS_DIR -mindepth 1 -maxdepth 1 -type d) ; do
  47. HDPREPO_DIR=$HDP_VERSION_DIR/repos
  48. echo "Replacing $ver latest lookup url to '$LATEST_URL'"
  49. sed "s;\(<latest>\)\([^>]*\)\(<\/latest>\);\1$LATEST_URL\3;" ${HDPREPO_DIR}/repoinfo.xml > ${HDPREPO_DIR}/repoinfo.xml.tmp; mv ${HDPREPO_DIR}/repoinfo.xml.tmp ${HDPREPO_DIR}/repoinfo.xml
  50. done
  51. fi