Skip to content

Instantly share code, notes, and snippets.

@tPl0ch
Forked from jmather/Vagrantfile
Created October 30, 2012 15:06
Show Gist options
  • Save tPl0ch/3980764 to your computer and use it in GitHub Desktop.
Save tPl0ch/3980764 to your computer and use it in GitHub Desktop.
Vagrant setup
#!/bin/sh
NFSUID=`stat -c %u /vagrant/`
sudo su -c "cat /etc/passwd | grep -v vagrant:x: > /etc/passwd.new"
sudo su -c "echo \"vagrant:x:${NFSUID}:502::/home/vagrant:/bin/bash\" >> /etc/passwd.new"
sudo su -c "chown -R ${NFSUID}:vagrant /home/vagrant"
sudo su -c "mv -f /etc/passwd.new /etc/passwd"
sudo su vagrant -c "mkdir -p /vagrant/http-logs"
if [ -d /vagrant/web ] && [ ! -f /vagrant/.vagrant.force.global ]
then
sudo cp -f /home/vagrant/files/app.conf /etc/httpd/conf.d/vagrant.conf
else
sudo cp -f /home/vagrant/files/global.conf /etc/httpd/conf.d/vagrant.conf
fi
sudo /etc/init.d/httpd restart
echo "Finished"
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.provision OnHostProvisioner
end
class OnHostProvisioner < Vagrant::Provisioners::Base
def provision!
env[:vm].channel.execute("/home/vagrant/provision.sh")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment