set-hdp-repo-url.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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.0.6
  28. C6URL="$1"
  29. C5URL="${C6URL/centos6/centos5}"
  30. S11URL="${C6URL/centos6/suse11}"
  31. if [ "$#" != 2 ]
  32. then
  33. HDPREPO=target/classes/stacks/HDP/${VERSION}/repos
  34. HDPLOCALREPO=target/classes/stacks/HDPLocal/${VERSION}/repos
  35. else
  36. HDPREPO=$2/var/lib/ambari-server/resources/stacks/HDP/${VERSION}/repos
  37. HDPLOCALREPO=$2/var/lib/ambari-server/resources/stacks/HDPLocal/${VERSION}/repos
  38. fi
  39. echo "Processing '${HDPREPO}/repoinfo.xml' and '${HDPLOCALREPO}/repoinfo.xml'"
  40. echo "$2"
  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. sed "s;REPLACE_WITH_CENTOS5_URL;$C5URL;" ${HDPLOCALREPO}/repoinfo.xml > ${HDPLOCALREPO}/repoinfo.xml.tmp; mv ${HDPLOCALREPO}/repoinfo.xml.tmp ${HDPLOCALREPO}/repoinfo.xml
  44. echo "Setting centos6 stack url to '$C6URL'"
  45. sed "s;REPLACE_WITH_CENTOS6_URL;$C6URL;" ${HDPREPO}/repoinfo.xml > ${HDPREPO}/repoinfo.xml.tmp; mv ${HDPREPO}/repoinfo.xml.tmp ${HDPREPO}/repoinfo.xml
  46. sed "s;REPLACE_WITH_CENTOS6_URL;$C6URL;" ${HDPLOCALREPO}/repoinfo.xml > ${HDPLOCALREPO}/repoinfo.xml.tmp; mv ${HDPLOCALREPO}/repoinfo.xml.tmp ${HDPLOCALREPO}/repoinfo.xml
  47. echo "Setting suse11 stack url to '$S11URL'"
  48. sed "s;REPLACE_WITH_SUSE11_URL;$S11URL;" ${HDPREPO}/repoinfo.xml > ${HDPREPO}/repoinfo.xml.tmp; mv ${HDPREPO}/repoinfo.xml.tmp ${HDPREPO}/repoinfo.xml
  49. sed "s;REPLACE_WITH_SUSE11_URL;$S11URL;" ${HDPLOCALREPO}/repoinfo.xml > ${HDPLOCALREPO}/repoinfo.xml.tmp; mv ${HDPLOCALREPO}/repoinfo.xml.tmp ${HDPLOCALREPO}/repoinfo.xml
  50. fi