Skip to content

Commit 6314610

Browse files
author
Artis Abolts
committed
Improved Vagrant provisioning, do not check Oracle installation file by starting already provisioned box
1 parent 88fed80 commit 6314610

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

Vagrantfile

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
22
VAGRANTFILE_API_VERSION = "2"
33

4-
if ! File.exists?('./oracle-xe-11.2.0-1.0.x86_64.rpm.zip')
5-
puts 'Oracle XE database installation (oracle-xe-11.2.0-1.0.x86_64.rpm.zip) can not be found. Please download from Oracle homepage'
6-
exit 1
7-
end
8-
94
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
105

116
# Every Vagrant virtual environment requires a box to build off of.
127
config.vm.box = "chef/centos-6.6"
13-
148
config.vm.hostname = "vagrant.oracle"
15-
169
config.vm.network :forwarded_port, guest: 1521, host: 1521
17-
# config.vm.network :forwarded_port, guest: 8080, host: 8080
1810

1911
config.vm.provider :virtualbox do |vb|
2012
vb.name = "Ruby-PLSQL Oracle XE box"
@@ -25,11 +17,13 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
2517
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
2618
end
2719

20+
# Check for Oracle XE installation file
21+
config.vm.provision :shell, path: "./spec/support/file_check_script.sh"
22+
2823
config.vm.provision :shell, inline: "yum update -y"
2924
config.vm.provision :shell, inline: "yum install -y libaio bc flex unzip"
3025
config.vm.provision :shell, inline: "mkdir -p /opt/oracle"
31-
config.vm.provision :shell, inline: "cp /vagrant/oracle-xe* /opt/oracle"
32-
config.vm.provision :shell, inline: "cd /opt/oracle && unzip -q oracle-xe-11.2.0-1.0.x86_64.rpm.zip"
26+
config.vm.provision :shell, inline: "unzip -q -d /opt/oracle /vagrant/oracle-xe-11.2.0-1.0.x86_64.rpm.zip"
3327
config.vm.provision :shell, inline: "cd /opt/oracle/Disk1 && rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm"
3428
config.vm.provision :shell, inline: "cp /opt/oracle/Disk1/response/xe.rsp /opt/oracle/Disk1/response/xe.rsp-bak"
3529
config.vm.provision :shell, inline: %q{sed -i -E "s/<value required>/oracle/" /opt/oracle/Disk1/response/xe.rsp}

spec/support/file_check_script.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
set -e
3+
4+
FILE=/vagrant/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
5+
6+
if [ ! -f "$FILE" ] ; then
7+
echo "Oracle XE database installation (oracle-xe-11.2.0-1.0.x86_64.rpm.zip) can not be found. Please download from Oracle homepage and put it into project home directory."
8+
exit 1
9+
fi

0 commit comments

Comments
 (0)