oo-install-bootstrap.sh 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/sh
  2. # Grab command-line arguments
  3. cmdlnargs="$@"
  4. : ${OO_INSTALL_KEEP_ASSETS:="false"}
  5. : ${OO_INSTALL_CONTEXT:="INSTALLCONTEXT"}
  6. : ${TMPDIR:=/tmp}
  7. : ${OO_INSTALL_LOG:=${TMPDIR}/INSTALLPKGNAME.log}
  8. [[ $TMPDIR != */ ]] && TMPDIR="${TMPDIR}/"
  9. if [ $OO_INSTALL_CONTEXT != 'origin_vm' ]
  10. then
  11. clear
  12. echo "Checking for necessary tools..."
  13. fi
  14. if [ -e /etc/redhat-release ]
  15. then
  16. for i in python python-virtualenv openssh-clients gcc
  17. do
  18. rpm -q $i >/dev/null 2>&1 || { echo >&2 "Missing installation dependency detected. Please run \"yum install ${i}\"."; exit 1; }
  19. done
  20. fi
  21. for i in python virtualenv ssh gcc
  22. do
  23. command -v $i >/dev/null 2>&1 || { echo >&2 "OpenShift installation requires $i on the PATH but it does not appear to be available. Correct this and rerun the installer."; exit 1; }
  24. done
  25. # All instances of INSTALLPKGNAME are replaced during packaging with the actual package name.
  26. if [[ -e ./INSTALLPKGNAME.tgz ]]
  27. then
  28. if [ $OO_INSTALL_CONTEXT != 'origin_vm' ]
  29. then
  30. echo "Using bundled assets."
  31. fi
  32. cp INSTALLPKGNAME.tgz ${TMPDIR}/INSTALLPKGNAME.tgz
  33. elif [[ $OO_INSTALL_KEEP_ASSETS == 'true' && -e ${TMPDIR}/INSTALLPKGNAME.tgz ]]
  34. then
  35. if [ $OO_INSTALL_CONTEXT != 'origin_vm' ]
  36. then
  37. echo "Using existing installer assets."
  38. fi
  39. else
  40. echo "Downloading oo-install package to ${TMPDIR}INSTALLPKGNAME.tgz..."
  41. curl -s -o ${TMPDIR}INSTALLPKGNAME.tgz https://install.openshift.com/INSTALLVERPATHINSTALLPKGNAME.tgz
  42. fi
  43. if [ $OO_INSTALL_CONTEXT != 'origin_vm' ]
  44. then
  45. echo "Extracting oo-install to ${TMPDIR}INSTALLPKGNAME..."
  46. fi
  47. tar xzf ${TMPDIR}INSTALLPKGNAME.tgz -C ${TMPDIR} 2>&1 >> $OO_INSTALL_LOG
  48. echo "Preparing to install. This can take a minute or two..."
  49. virtualenv ${TMPDIR}/INSTALLPKGNAME 2>&1 >> $OO_INSTALL_LOG
  50. cd ${TMPDIR}/INSTALLPKGNAME 2>&1 >> $OO_INSTALL_LOG
  51. source ./bin/activate 2>&1 >> $OO_INSTALL_LOG
  52. pip install --no-index -f file:///$(readlink -f deps) ansible 2>&1 >> $OO_INSTALL_LOG
  53. # TODO: these deps should technically be handled as part of installing ooinstall
  54. pip install --no-index -f file:///$(readlink -f deps) click 2>&1 >> $OO_INSTALL_LOG
  55. pip install --no-index ./src/ 2>&1 >> $OO_INSTALL_LOG
  56. echo "Installation preperation done!" 2>&1 >> $OO_INSTALL_LOG
  57. echo "Using `ansible --version`" 2>&1 >> $OO_INSTALL_LOG
  58. if [ $OO_INSTALL_CONTEXT != 'origin_vm' ]
  59. then
  60. echo "Starting oo-install..." 2>&1 >> $OO_INSTALL_LOG
  61. else
  62. clear
  63. fi
  64. oo-install $cmdlnargs --ansible-playbook-directory ${TMPDIR}/INSTALLPKGNAME/openshift-ansible-*/ --ansible-log-path $OO_INSTALL_LOG
  65. if [ $OO_INSTALL_KEEP_ASSETS == 'true' ]
  66. then
  67. echo "Keeping temporary assets in ${TMPDIR}"
  68. else
  69. echo "Removing temporary assets."
  70. rm -rf ${TMPDIR}INSTALLPKGNAME
  71. rm -rf ${TMPDIR}INSTALLPKGNAME.tgz
  72. fi
  73. echo "Please see $OO_INSTALL_LOG for full output."
  74. exit