Skip to content

Instantly share code, notes, and snippets.

@kurobeats
Created November 1, 2016 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurobeats/294969aa054d0fa1f653f5f38f1d63d0 to your computer and use it in GitHub Desktop.
Save kurobeats/294969aa054d0fa1f653f5f38f1d63d0 to your computer and use it in GitHub Desktop.
Vagrant to libvirt image maker
#!/usr/bin/bash
d_util=wget
distro=debian
release=jessie64
version=8.6.1
working_dir="/tmp"
boxid=`< /dev/urandom tr -dc a-z-0-9 | head -c8; echo`
inseckey="https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant"
cd $working_dir
$d_util https://atlas.hashicorp.com/$distro/boxes/$release/versions/$version/providers/virtualbox.box -O virtualbox.box
$d_util $inseckey -O ~/.ssh/vagrant
tar -xaf virtualbox.box
qemu-img convert -O qcow2 ./box-disk1.vmdk /mnt/hdd/vms/$distro_$boxid.qcow2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment