Alternate oracle-xe download in .travis.yml

This commit is contained in:
Travis Burtrum 2018-09-20 23:59:37 -04:00
parent 22fad7f487
commit 1e9bf0dc5a
3 changed files with 40 additions and 6 deletions

View File

@ -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:

5
.travis/oracle/download.sh Executable file
View File

@ -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

34
.travis/oracle/install.sh Executable file
View File

@ -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 <<SQL
CREATE USER $USER IDENTIFIED EXTERNALLY;
GRANT CONNECT, RESOURCE TO $USER;
SQL