Cleanup setup script
This commit is contained in:
parent
55c9be772d
commit
863473bfe6
1 changed files with 13 additions and 9 deletions
|
@ -32,6 +32,10 @@ def restore_snapshot!
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def vagrant_ssh(cmd)
|
||||||
|
sh "vagrant ssh -c \"#{cmd}\""
|
||||||
|
end
|
||||||
|
|
||||||
# Initialize git submodules
|
# Initialize git submodules
|
||||||
sh 'git submodule update --init'
|
sh 'git submodule update --init'
|
||||||
|
|
||||||
|
@ -64,34 +68,34 @@ download "#{IMAGE_ROOT}/#{IMAGE_NAME}", IMAGE_NAME
|
||||||
sh 'vagrant up'
|
sh 'vagrant up'
|
||||||
|
|
||||||
# Because I'm lazy ;)
|
# Because I'm lazy ;)
|
||||||
sh 'vagrant ssh -c "echo \'cd /vagrant\' >> ~/.bashrc"'
|
vagrant_ssh "echo 'cd /vagrant' >> ~/.bashrc"
|
||||||
|
|
||||||
# "be" archive is too slow for me
|
# "be" archive is too slow for me
|
||||||
sh 'vagrant ssh -c "sudo sed -i -e \'s/be.archive/br.archive/g\' /etc/apt/sources.list"'
|
vagrant_ssh "sudo sed -i -e 's/be.archive/br.archive/g' /etc/apt/sources.list"
|
||||||
|
|
||||||
# Ensure we have the latest packages around
|
# Ensure we have the latest packages around
|
||||||
sh 'vagrant ssh -c "sudo apt-get update && sudo apt-get upgrade -y"'
|
vagrant_ssh "sudo apt-get update && sudo apt-get upgrade -y"
|
||||||
|
|
||||||
# Ensure the machine can boot properly after upgrades
|
# Ensure the machine can boot properly after upgrades
|
||||||
sh 'vagrant reload'
|
sh 'vagrant reload'
|
||||||
|
|
||||||
# Install lxc, libffi, rinetd and bundler
|
# Install lxc, libffi, rinetd and bundler
|
||||||
sh 'vagrant ssh -c "sudo apt-get install lxc rinetd libffi-dev libffi-ruby ruby1.9.1-dev htop -y && sudo gem install bundler --no-ri --no-rdoc"'
|
vagrant_ssh "sudo apt-get install lxc rinetd libffi-dev libffi-ruby ruby1.9.1-dev htop -y && sudo gem install bundler --no-ri --no-rdoc"
|
||||||
|
|
||||||
# Backup rinetd config
|
# Backup rinetd config
|
||||||
sh "vagrant ssh -c 'cp /etc/rinetd.conf /vagrant/cache/rinetd.conf'"
|
vagrant_ssh "cp /etc/rinetd.conf /vagrant/cache/rinetd.conf"
|
||||||
|
|
||||||
# Make rinetd writable by vagrant user
|
# Make rinetd writable by vagrant user
|
||||||
sh "vagrant ssh -c 'sudo chown vagrant:vagrant /etc/rinetd.conf'"
|
vagrant_ssh 'sudo chown vagrant:vagrant /etc/rinetd.conf'
|
||||||
|
|
||||||
# Bundle!
|
# Bundle!
|
||||||
sh "vagrant ssh -c 'cd /vagrant && bundle'"
|
vagrant_ssh 'cd /vagrant && bundle'
|
||||||
|
|
||||||
# Setup vagrant default ssh key
|
# Setup vagrant default ssh key
|
||||||
sh 'vagrant ssh -c "cp /vagrant/vagrant-1.1/keys/vagrant ~/.ssh/id_rsa && cp /vagrant/vagrant-1.1/keys/vagrant.pub ~/.ssh/id_rsa.pub && chmod 600 ~/.ssh/id_rsa"'
|
vagrant_ssh "cp /vagrant/vagrant-1.1/keys/vagrant ~/.ssh/id_rsa && cp /vagrant/vagrant-1.1/keys/vagrant.pub ~/.ssh/id_rsa.pub && chmod 600 ~/.ssh/id_rsa"
|
||||||
|
|
||||||
# Setup lxc cache
|
# Setup lxc cache
|
||||||
sh "vagrant ssh -c 'sudo mkdir -p /var/cache/lxc/cloud-quantal && sudo cp /vagrant/cache/#{IMAGE_NAME} /var/cache/lxc/cloud-quantal/#{IMAGE_NAME}'"
|
vagrant_ssh "sudo mkdir -p /var/cache/lxc/cloud-quantal && sudo cp /vagrant/cache/#{IMAGE_NAME} /var/cache/lxc/cloud-quantal/#{IMAGE_NAME}"
|
||||||
|
|
||||||
# Click
|
# Click
|
||||||
sh 'vagrant halt'
|
sh 'vagrant halt'
|
||||||
|
|
Loading…
Reference in a new issue