gael-ian / vagrant-bindfs

A Vagrant plugin to automate bindfs mount in the VM
MIT License
483 stars 37 forks source link

added support for CentOS 5 & 6 #24

Closed ricoli closed 9 years ago

ricoli commented 9 years ago

Aftermath of https://github.com/gael-ian/vagrant-bindfs/pull/23, now branched from original repo's master.

andrewnoruk commented 9 years ago

I just tested this using a vanilla CentOS base box and found two issues.

First, the installation of bindfs was failing on ./configure && make && make install because the cd was being done in a separate call to comm.sudo. I added some comments here

Second, calls to bindfs were failing because the binary was installed in /usr/local/bin and the root $PATH does not include it by default.

While debugging I was able to get everything working by replacing these lines:

comm.sudo('cd bindfs-1.12.6') comm.sudo('./configure && make && make install')

with these lines:

comm.sudo('cd bindfs-1.12.6 && ./configure && make && make install') comm.sudo('mv /usr/local/bin/bindfs /usr/bin')

however the mv feels kind of kludgy. Any ideas how to avoid having to move the bindfs binary?

ricoli commented 9 years ago

Thank you very much @the-andrew ! I'll make the changes, and instead of a mv we can simply symlink :)

andrewnoruk commented 9 years ago

@ricoli I tested your latest version and everything worked swimmingly. I think this is ready to be merged :+1:

ricoli commented 9 years ago

great @the-andrew , thanks a lot for testing it :) ping @gael-ian

JulianVolodia commented 9 years ago

Is it working on both, Red Hat and CentOS? @the-andrew?

ricoli commented 9 years ago

well if the distro is of redhat type and not centos6 then it will try installing the package via yum. If it doesn't exist then it's a fail. Maybe the title of this PR needs rephrasing :) Then again, feel free to expand the support beyond this PR

andrewnoruk commented 9 years ago

@JulianVolodia I've only tested it with CentOS, but like @ricoli said it will still use the yum install as a fallback

ricoli commented 9 years ago

according to http://pkgs.org/search/bindfs Redhat distros don't have a package for it apart from centos 5 :(

gael-ian commented 9 years ago

Thanks all !

Is it possible to add some error checks ? I didn't have much time today but think something like this should work :

comm.sudo('yum -y install fuse fuse-devel')
comm.sudo('[ ! -f ~/bindfs-1.12.6.tar.gz ] && wget http://bindfs.org/downloads/bindfs-1.12.6.tar.gz; true')
comm.sudo('[ -f ~/bindfs-1.12.6.tar.gz ] && tar -zxvf bindfs-1.12.6.tar.gz')
comm.sudo('[ -d ~/bindfs-1.12.6 ] && cd ~/bindfs-1.12.6 && ./configure && make && make install && ln -s /usr/local/bin/bindfs /usr/bin')

A VagrantPlugins::Bindfs::LAST_SUPPORTED_VERSION constant (declared in version.rb ?) would be great too.

I should have some time tomorrow to merge it and push a new release on rubygems.

ricoli commented 9 years ago

@gael-ian I've made some changes, let me know what you think... I went for overwrite instead of testing for presence. @the-andrew if you don't mind testing it too, I'd appreciate :)

andrewnoruk commented 9 years ago

@ricoli there were a few bugs in the most recent commits, I've submitted a PR https://github.com/ricoli/vagrant-bindfs/pull/1 with the fixes. The PR code is tested and working.

gael-ian commented 9 years ago

Your PR is merged and the 0.3.3 version is available on rubygems. Thanks to you!

ricoli commented 9 years ago

Thank you @the-andrew for helping me out :)