diff --git a/.travis.yml b/.travis.yml index 967707a..04100ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -89,13 +89,8 @@ matrix: before_install: - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh - - wget 'https://github.com/cbandy/travis-oracle/archive/v2.0.3.tar.gz' - mkdir -p $HOME/.traviscache - - mkdir -p .travis/oracle - - tar x -C .travis/oracle --strip-components=1 -f v2.0.3.tar.gz - - if [[ ! -f $HOME/.traviscache/oracle-xe-11.2.0-1.0.x86_64.rpm.zip ]]; then - .travis/oracle/download.sh; - fi + - .travis/oracle/download.sh - .travis/oracle/install.sh install: diff --git a/.travis/oracle/download.sh b/.travis/oracle/download.sh new file mode 100755 index 0000000..3699324 --- /dev/null +++ b/.travis/oracle/download.sh @@ -0,0 +1,5 @@ +#!/bin/bash +if [[ ! -f $HOME/.traviscache/oracle-xe-11.2.0-1.0.x86_64.rpm.zip ]] +then + wget -O $HOME/.traviscache/oracle-xe-11.2.0-1.0.x86_64.rpm.zip "$ORACLE_XE_URL" +fi diff --git a/.travis/oracle/install.sh b/.travis/oracle/install.sh new file mode 100755 index 0000000..71d89a5 --- /dev/null +++ b/.travis/oracle/install.sh @@ -0,0 +1,34 @@ +#!/bin/sh -e +# vim: set et sw=2 ts=2: + +[ -z "$ORACLE_DOWNLOAD_DIR" ] || ORACLE_DOWNLOAD_DIR="$(readlink -f "$ORACLE_DOWNLOAD_DIR")/" +[ -n "$ORACLE_FILE" ] || { echo "Missing ORACLE_FILE environment variable!"; exit 1; } +[ -n "$ORACLE_HOME" ] || { echo "Missing ORACLE_HOME environment variable!"; exit 1; } + +ORACLE_RPM="$(basename "$ORACLE_FILE" .zip)" + +cd "$(dirname "$(readlink -f "$0")")" + +dpkg -s bc libaio1 rpm unzip > /dev/null 2>&1 || + ( sudo apt-get -qq update && sudo apt-get --no-install-recommends -qq install bc libaio1 rpm unzip ) + +df -B1 /dev/shm | awk 'END { if ($1 != "shmfs" && $1 != "tmpfs" || $2 < 2147483648) exit 1 }' || + ( sudo rm -r /dev/shm && sudo mkdir /dev/shm && sudo mount -t tmpfs shmfs -o size=2G /dev/shm ) + +test -f /sbin/chkconfig || + ( echo '#!/bin/sh' | sudo tee /sbin/chkconfig > /dev/null && sudo chmod u+x /sbin/chkconfig ) + +test -d /var/lock/subsys || sudo mkdir /var/lock/subsys + +unzip -j "${ORACLE_DOWNLOAD_DIR}$(basename "$ORACLE_FILE")" "*/$ORACLE_RPM" +sudo rpm --install --nodeps --nopre "$ORACLE_RPM" + +echo 'OS_AUTHENT_PREFIX=""' | sudo tee -a "$ORACLE_HOME/config/scripts/init.ora" > /dev/null +sudo usermod -aG dba $USER + +( echo ; echo ; echo travis ; echo travis ; echo n ) | sudo AWK='/usr/bin/awk' /etc/init.d/oracle-xe configure + +"$ORACLE_HOME/bin/sqlplus" -L -S / AS SYSDBA <