mirror of
https://github.com/moparisthebest/JdbcMapper
synced 2024-12-22 07:18:51 -05:00
35 lines
1.4 KiB
Bash
35 lines
1.4 KiB
Bash
|
#!/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
|