hilverd / vagrant-ubuntu-oracle-xe

Install Oracle 11g XE in a Vagrant virtual machine running Ubuntu 12.04.
MIT License
287 stars 96 forks source link

Symlink to oracle zip? #4

Closed bane73 closed 10 years ago

bane73 commented 11 years ago

First, I admit up-front it's a bit of a "6 of one, half-dozen of the other"-situation... and I'm not positive if it will actually work or not.. but I'm wondering if you might consider adding a symlink for where the oracle zip SHOULD be and have it directed somewhere outside of the vagrant box?

There are a few benefits (I think): 1) you only copy the file once to the standard location 2) you can setup the box as many times as you want without doing anything extra 3) you don't mistakenly lose the file if you destroy and rm -rf the vagrant box

Small things, I know, but it seems a small change too.

Something like this, I guess:

ln -s ~/vagrant/vagrant_resources/oracle-xe-11.2.0-1.0.x86_64.rpm.zip ~/vagrant/vagrant-ubuntu-oracle-xe/modules/oracle/files/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
hilverd commented 11 years ago

Thanks! I agree that creating a link to the actual zip file is good practice, for the reasons you mention.

Apparently Puppet supports this -- if you add links => follow then it will use the target file instead of a link. But I found that symlinking to a file outside the modules directory does not work, as Vagrant mounts only this directory onto the VM for Puppet. I think there are two ways to handle this.

  1. Create a hard link instead by taking out the -s option.
  2. Have Vagrant somehow mount the directory containing the actual zip file (e.g. ~/vagrant/vagrant_resources) as well. The symlink would need to point to the zip file inside this extra mounted directory. This seems much too complicated.

I've just tried approach 1 which works fine, and still has the same benefits, don't you think? I will add a note about this to the README when I get a moment.

bane73 commented 11 years ago

Nice! Indeed, I think #1 sounds acceptable provided it doesn't require the user create the hardlink themselves... ? Ideally the user should only have to create the standard directory and add the file there one time and never themselves touch the hardlink, thereby allowing them to easily tear the box down and fire it up again with no extra intervention. Do you think that will be a problem?

hilverd commented 11 years ago

Sorry for the slow reply. If you use vagrant destroy to tear down the box -- and vagrant up to rebuild it -- then the files in the project directory (including the Oracle zip file) are left untouched. So you would need to create the hard link manually only once, unless you rm -rf the project directory of course. Alternatively, if the zip file has been placed in a standard location, maybe the hard link to (or copy of) the zip file could be created automatically as part of vagrant up. That's a bit more complex and I'm not sure if it is worth the trouble.

I'm inclined to just add a suggestion to the README about putting the Oracle zip file in a standard location and manually creating a hard link to it inside modules/oracle/files.