Skip to content

Instantly share code, notes, and snippets.

@justone
Created November 11, 2013 17:29
Show Gist options
  • Save justone/7416977 to your computer and use it in GitHub Desktop.
Save justone/7416977 to your computer and use it in GitHub Desktop.
Vagrant shell provisioner to set up cpanm/carton
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# change to whatever box you want
config.vm.box = "ubuntu1204"
config.vm.provision :shell, :inline => <<DEV_PROVISION
#!/bin/bash
sudo -H -u vagrant /bin/bash - << EOF
# setup local::lib first
if [[ ! -d perl5 ]]; then
echo "setting up local::lib"
wget http://search.cpan.org/CPAN/authors/id/E/ET/ETHER/local-lib-1.008011.tar.gz
tar -xzvf local-lib-1.008011.tar.gz
cd local-lib-1.008011/
perl Makefile.PL --bootstrap
make test && make install
echo 'eval \\$(perl -I\\$HOME/perl5/lib/perl5 -Mlocal::lib)' >>~/.bashrc
cd -
rm -rf local-lib-1.008011*
fi
eval \\$(perl -I\\$HOME/perl5/lib/perl5 -Mlocal::lib)
## then install cpanm
[[ \\$(type -P cpanm) ]] || curl -L http://cpanmin.us | perl - App::cpanminus || exit
## finally, carton
[[ \\$(type -P carton) ]] || cpanm Carton || exit
EOF
DEV_PROVISION
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment