check-component-exists.sh.in 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. ###############################################################################
  3. # HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. #
  15. # limitations under the License.
  16. # along with All rights reserved. This program is free software: you can
  17. # redistribute program. If not, see <http://www.gnu.org/licenses/>.
  18. ###############################################################################
  19. ###<REPLACE>###
  20. if [[ $# != 1 ]]; then
  21. echo "Incorrect number of arguments to check-component-exists.sh"
  22. exit 1
  23. else
  24. component=${1}
  25. fi
  26. configgen_output="$(${INSTALL_DIR}/sbin/configgen -env ${CONFIG_DIR}/${ENV_XML_FILE} -list -c ${component})"
  27. if echo "${configgen_output}" | grep -q ${component}; then
  28. echo "Found component: ${component}"
  29. exit 0
  30. else
  31. echo "Undeclared Component: ${component}"
  32. exit 1
  33. fi