PageRenderTime 46ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/src/soci/bin/ci/before_install_oracle.sh

https://gitlab.com/vectorci/rippled
Shell | 123 lines | 54 code | 20 blank | 49 comment | 0 complexity | 43ae9185ba6a2fe49afd5c479951b631 MD5 | raw file
  1. #!/bin/bash
  2. # Script performs non-interactive installation of Oracle XE 10g on Debian
  3. #
  4. # Based on oracle10g-update.sh from HTSQL project:
  5. # https://bitbucket.org/prometheus/htsql
  6. #
  7. # Modified by Mateusz Loskot <mateusz@loskot.net>
  8. # Changes:
  9. # - Add fake swap support (backup /usr/bin/free manually anyway!)
  10. # - Increase Oracle XE's PROCESSES parameter to value from range 100-200.
  11. # Required to prevent random ORA-12520 errors while running tests.
  12. #
  13. # Modified by Peter Butkovic <butkovic@gmail.com> to enable i386 install on amd64 architecture (precise 64)
  14. # based on: http://www.ubuntugeek.com/how-to-install-oracle-10g-xe-in-64-bit-ubuntu.html
  15. #
  16. # set -ex
  17. source ${TRAVIS_BUILD_DIR}/bin/ci/common.sh
  18. #
  19. # Utilities
  20. #
  21. function free_backup()
  22. {
  23. # Multiple copies to be on safe side
  24. sudo cp /usr/bin/free /root
  25. sudo mv /usr/bin/free /usr/bin/free.original
  26. }
  27. function free_restore()
  28. {
  29. sudo cp /usr/bin/free.original /usr/bin/free
  30. }
  31. # Install fake free
  32. # http://www.axelog.de/2010/02/7-oracle-ee-refused-to-install-into-openvz/
  33. free_backup
  34. sudo tee /usr/bin/free <<EOF > /dev/null
  35. #!/bin/sh
  36. cat <<__eof
  37. total used free shared buffers cached
  38. Mem: 1048576 327264 721312 0 0 0
  39. -/+ buffers/cache: 327264 721312
  40. Swap: 2000000 0 2000000
  41. __eof
  42. exit
  43. EOF
  44. sudo chmod 755 /usr/bin/free
  45. #
  46. # ok, bc, is the dependency that is required by DB2 as well => let's remove it from oracle xe dependencies and provide 64bit one only
  47. #
  48. # Install the Oracle 10g dependant packages
  49. sudo apt-fast install -qq -y --force-yes libc6:i386
  50. # travis needs the "apt-transport-https" to enable https transport
  51. sudo apt-fast install -qq -y bc apt-transport-https
  52. # add Oracle repo + key (please note https is a must here, otherwise "apt-get update" fails for this repo with the "Undetermined error")
  53. sudo bash -c 'echo "deb https://oss.oracle.com/debian/ unstable main non-free" >/etc/apt/sources.list.d/oracle.list'
  54. wget -q https://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | sudo apt-key add -
  55. sudo apt-fast update -qq -y
  56. # only download the package, to manually install afterwards
  57. sudo apt-fast install -qq -y --force-yes -d oracle-xe-universal:i386
  58. sudo apt-fast install -qq -y --force-yes libaio:i386
  59. # remove key + repo (to prevent failures on next updates)
  60. sudo apt-key del B38A8516
  61. sudo bash -c 'rm -rf /etc/apt/sources.list.d/oracle.list'
  62. sudo apt-fast update -qq -y
  63. sudo apt-get autoremove -qq
  64. # remove bc from the dependencies of the oracle-xe-universal package (to keep 64bit one installed)
  65. mkdir /tmp/oracle_unpack
  66. dpkg-deb -x /var/cache/apt/archives/oracle-xe-universal_10.2.0.1-1.1_i386.deb /tmp/oracle_unpack
  67. cd /tmp/oracle_unpack
  68. dpkg-deb --control /var/cache/apt/archives/oracle-xe-universal_10.2.0.1-1.1_i386.deb
  69. sed -i "s/,\ bc//g" /tmp/oracle_unpack/DEBIAN/control
  70. mkdir /tmp/oracle_repack
  71. dpkg -b /tmp/oracle_unpack /tmp/oracle_repack/oracle-xe-universal_fixed_10.2.0.1-1.1_i386.deb
  72. # install Oracle 10g with the fixed dependencies, to prevent i386/amd64 conflicts on bc package
  73. sudo dpkg -i --force-architecture /tmp/oracle_repack/oracle-xe-universal_fixed_10.2.0.1-1.1_i386.deb
  74. # Fix the problem when the configuration script eats the last
  75. # character of the password if it is 'n': replace IFS="\n" with IFS=$'\n'.
  76. sudo sed -i -e s/IFS=\"\\\\n\"/IFS=\$\'\\\\n\'/ /etc/init.d/oracle-xe
  77. # Configure the server; provide the answers for the following questions:
  78. # The HTTP port for Oracle Application Express: 8080
  79. # A port for the database listener: 1521
  80. # The password for the SYS and SYSTEM database accounts: admin
  81. # Start the server on boot: yes
  82. sudo /etc/init.d/oracle-xe configure <<END
  83. 8080
  84. 1521
  85. admin
  86. admin
  87. y
  88. END
  89. # Load Oracle environment variables so that we could run `sqlplus`.
  90. . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
  91. # Increase the number of connections.
  92. echo "ALTER SYSTEM SET PROCESSES=200 SCOPE=SPFILE;" | \
  93. sqlplus -S -L sys/admin AS SYSDBA
  94. # need to restart, to apply connection number update
  95. sudo /etc/init.d/oracle-xe restart
  96. # Set Oracle environment variables on login.
  97. # NOTE, mloskot: On Travis CI, fails with Permission denied
  98. #sudo cat <<END >>/root/.bashrc
  99. #. /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
  100. #END
  101. free_restore
  102. # Install development toolset for 32-bit for Travis CI 64-bit
  103. sudo apt-fast install -qq -y g++-multilib