install-helper.cmd 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. rem Licensed to the Apache Software Foundation (ASF) under one or more
  2. rem contributor license agreements. See the NOTICE file distributed with
  3. rem this work for additional information rega4rding copyright ownership.
  4. rem The ASF licenses this file to You under the Apache License, Version 2.0
  5. rem (the "License"); you may not use this file except in compliance with
  6. rem the License. You may obtain a copy of the License at
  7. rem
  8. rem http://www.apache.org/licenses/LICENSE-2.0
  9. rem
  10. rem Unless required by applicable law or agreed to in writing, software
  11. rem distributed under the License is distributed on an "AS IS" BASIS,
  12. rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. rem See the License for the specific language governing permissions and
  14. rem limitations under the License.
  15. rem ##################################################################
  16. rem # SERVER INSTALL HELPER #
  17. rem ##################################################################
  18. set COMMON_DIR="/usr/lib/python2.6/site-packages/common_functions"
  19. set INSTALL_HELPER_AGENT="/var/lib/ambari-agent/install-helper.sh"
  20. set COMMON_DIR_SERVER="/usr/lib/ambari-server/lib/common_functions"
  21. set PYTHON_WRAPER_TARGET="/usr/bin/ambari-python-wrap"
  22. set PYTHON_WRAPER_SOURCE="/var/lib/ambari-server/ambari-python-wrap"
  23. do_install(){
  24. # setting common_functions shared resource
  25. if [ ! -d "$COMMON_DIR" ]; then
  26. ln -s "$COMMON_DIR_SERVER" "$COMMON_DIR"
  27. fi
  28. # setting python-wrapper script
  29. if [ ! -f "$PYTHON_WRAPER_TARGET" ]; then
  30. ln -s "$PYTHON_WRAPER_SOURCE" "$PYTHON_WRAPER_TARGET"
  31. fi
  32. }
  33. do_remove(){
  34. if [ -d "$COMMON_DIR" ]; then # common dir exists
  35. rm -f "$COMMON_DIR"
  36. fi
  37. if [ -f "$PYTHON_WRAPER_TARGET" ]; then
  38. rm -f "$PYTHON_WRAPER_TARGET"
  39. fi
  40. # if server package exists, restore their settings
  41. if [ -f "$INSTALL_HELPER_AGENT" ]; then # call agent shared files installer
  42. $INSTALL_HELPER_AGENT install
  43. fi
  44. }
  45. case "$1" in
  46. install)
  47. do_install
  48. ;;
  49. remove)
  50. do_remove
  51. ;;
  52. esac