Browse Source

support Debian / virtualbox via Vagrant Cloud

vbox
Devrandom 5 years ago
parent
commit
496f45d17b
  1. 28
      Vagrantfile
  2. 10
      bin/make-base-vm

28
Vagrantfile vendored

@ -12,27 +12,45 @@ echo "ok" @@ -12,27 +12,45 @@ echo "ok"
SCRIPT
archs = ["amd64", "i386"]
suites = ["precise", "quantal", "raring", "saucy", "trusty"]
ubuntu_suites = ["precise", "quantal", "raring", "saucy", "trusty", "xenial"]
debian_suites = ["jessie", "stretch"]
if ARGV[0] == "up" and ARGV.length == 1
puts "Specify a name of the form 'suite-architecture'"
puts " suites: " + suites.join(', ')
puts " ubuntu suites: " + ubuntu_suites.join(', ')
puts " debian suites (x86_64 only): " + debian_suites.join(', ')
puts " architectures: " + archs.join(', ')
Process.exit 1
end
Vagrant.configure("2") do |config|
# vagrant 1.9.1 (Ubuntu 17.10) compat
if Vagrant::DEFAULT_SERVER_URL =~ /hashicorp/
Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
end
Vagrant.configure("2") do |config|
config.vm.provision "shell", inline: $script
config.vm.network :forwarded_port, id: "ssh", guest: 22, host: 2223
suites.each do |suite|
debian_suites.each do |suite|
name = "#{suite}-amd64"
box = "debian/#{suite}64"
config.vm.define name do |config|
config.vm.box = box
config.vm.provider :virtualbox do |vb|
vb.name = "Gitian-#{name}"
end
end
end
ubuntu_suites.each do |suite|
archs.each do |arch|
name = "#{suite}-#{arch}"
config.vm.define name do |config|
config.vm.box = name
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/#{suite}/current/#{suite}-server-cloudimg-#{arch}-vagrant-disk1.box"
config.vm.box_url = "https://cloud-images.ubuntu.com/#{suite}/current/#{suite}-server-cloudimg-#{arch}-vagrant.box"
config.vm.provider :virtualbox do |vb|
vb.name = "Gitian-#{name}"
end

10
bin/make-base-vm

@ -112,6 +112,7 @@ elif [ $DISTRO = "debian" ]; then @@ -112,6 +112,7 @@ elif [ $DISTRO = "debian" ]; then
FLAVOUR=686-pae
fi
LOCALE_PKG=language-pack-en
if [ $DISTRO = "debian" ]; then
LOCALE_PKG=locales
@ -159,7 +160,16 @@ if [ $VBOX = "1" ]; then @@ -159,7 +160,16 @@ if [ $VBOX = "1" ]; then
exit 1
fi
DISTRO_USER_CREATE=0
if [ $DISTRO = "debian" ]; then
# we use a vagrant provider
DISTRO_USER_CREATE=1
fi
vagrant up "$NAME"
if [ $DISTRO_USER_CREATE = "1" ]; then
vagrant ssh "$NAME" -c "sudo useradd -m -s /bin/bash $DISTRO"
fi
vagrant ssh "$NAME" -c "sudo mkdir -p /root/.ssh && sudo chmod 700 /root/.ssh"
vagrant ssh "$NAME" -c "sudo sh -c 'cat >> /root/.ssh/authorized_keys'" < var/id_rsa.pub

Loading…
Cancel
Save