mirror of
https://github.com/SOCI/soci.git
synced 2026-05-07 04:10:02 -05:00
48c0cd4e9c
It doesn't make sense to call these scripts "before install" because they do actually install things themselves. In fact the whole separation into "install" and "before build" is probably not very useful, but keep it as long as we keep using Travis CI at all, as it maps better to its config file keys. No real changes.
26 lines
996 B
Bash
Executable File
26 lines
996 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Part of Vagrant virtual development environments for SOCI
|
|
|
|
# Installs DB2 Express-C 9.7
|
|
# Pre-installation
|
|
source /vagrant/scripts/vagrant/common.env
|
|
export DEBIAN_FRONTEND="noninteractive"
|
|
# Installation
|
|
/vagrant/scripts/ci/install_db2.sh
|
|
# Post-installation
|
|
## Let's be gentle to DB2 and try to not to recreate existing databases
|
|
echo "db2: checking if ${SOCI_USER} database exists"
|
|
# First time guest machine is created, there is no database, hence test for:
|
|
# SQL1031N The database directory cannot be found on the indicated file system.
|
|
sudo -u db2inst1 -i db2 "LIST DATABASE DIRECTORY" | grep SQL1031N
|
|
NODB=$?
|
|
sudo -u db2inst1 -i db2 "LIST DATABASE DIRECTORY" | grep -i ${SOCI_USER}
|
|
HASSOCI=$?
|
|
if [[ $NODB -eq 0 || $HASSOCI -ne 0 ]]; then
|
|
echo "db2: creating database ${SOCI_USER}"
|
|
sudo -u db2inst1 -i db2 "CREATE DATABASE ${SOCI_USER}"
|
|
sudo -u db2inst1 -i db2 "ACTIVATE DATABASE ${SOCI_USER}"
|
|
else
|
|
echo "db2: database ${SOCI_USER} (may) exists, skipping"
|
|
fi
|