diff options
author | Guo Ruijing <ruijing.guo@intel.com> | 2017-11-16 19:16:16 -0500 |
---|---|---|
committer | Guo Ruijing <ruijing.guo@intel.com> | 2017-11-19 13:03:31 -0500 |
commit | 39730e33e9e020930990e4f9d23128df25a2c94c (patch) | |
tree | 761ae03616c662038a08caf6249c06517f005a3b /ci/setup_vagrant.sh | |
parent | d2116720abfb794375875c1b41c0bc06e2f3e7db (diff) |
build vagrant box by chef/bento
Change-Id: I83bfb13ae8c0dcf48c3ab23054cfe4531c12fa8e
Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
Diffstat (limited to 'ci/setup_vagrant.sh')
-rwxr-xr-x | ci/setup_vagrant.sh | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/ci/setup_vagrant.sh b/ci/setup_vagrant.sh index a7427be..3cc05de 100755 --- a/ci/setup_vagrant.sh +++ b/ci/setup_vagrant.sh @@ -2,27 +2,43 @@ set -ex -cat << EOF | sudo tee /etc/sudoers.d/${USER} +install_packages() +{ + cat << EOF | sudo tee /etc/sudoers.d/${USER} ${USER} ALL = (root) NOPASSWD:ALL EOF + sudo apt-get update -y + sudo apt-get install -y openssh-server git virtualbox unzip + wget https://releases.hashicorp.com/vagrant/1.8.7/vagrant_1.8.7_x86_64.deb + sudo dpkg -i vagrant_1.8.7_x86_64.deb + rm -rf vagrant_1.8.7_x86_64.deb +} -sudo apt-get update -y -sudo apt-get install -y openssh-server git virtualbox -wget https://releases.hashicorp.com/vagrant/1.8.7/vagrant_1.8.7_x86_64.deb -sudo dpkg -i vagrant_1.8.7_x86_64.deb -rm -rf vagrant_1.8.7_x86_64.deb +build_box() { + rm -rf ~/'VirtualBox VMs'/ubuntu-16.04-amd64 + rm -rf bento + # Thanks Bento's great effort + # Bento project(https://github.com/chef/bento) is released by Apache 2.0 License + git clone https://github.com/chef/bento + cd bento; git checkout 05d98910d835b503e7be3d2e4071956f66fbbbc4 + wget https://releases.hashicorp.com/packer/1.1.2/packer_1.1.2_linux_amd64.zip + unzip packer_1.1.2_linux_amd64.zip + patch -p1 < ../bento.k8s.diff + cd ubuntu + ../packer build -var 'headless=true' -only=virtualbox-iso ubuntu-16.04-amd64.json + vagrant box remove -f opnfv/container4nfv --all || true + vagrant box add opnfv/container4nfv ../builds/ubuntu-16.04.virtualbox.box +} -vagrant destroy -f; rm -rf package.box -vagrant up -VBoxManage list vms | grep container4nfv | cut -f2 -d'"' | xargs -I {} vagrant package --base {} -vagrant box remove -f opnfv/container4nfv --all || true -vagrant box add opnfv/container4nfv file:package.box -vagrant destroy -f; rm -rf package.box +install_vagrant_libvirt() { + #refer to https://github.com/vagrant-libvirt/vagrant-libvirt + #sudo apt-get build-dep vagrant ruby-libvirt -y + sudo apt-get install -y qemu libvirt-bin ebtables dnsmasq + sudo apt-get install -y libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev + vagrant plugin install vagrant-libvirt + sudo adduser ${USER} libvirtd + sudo service libvirtd restart +} -#refer to https://github.com/vagrant-libvirt/vagrant-libvirt -#sudo apt-get build-dep vagrant ruby-libvirt -y -sudo apt-get install -y qemu libvirt-bin ebtables dnsmasq -sudo apt-get install -y libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev -vagrant plugin install vagrant-libvirt -sudo adduser ${USER} libvirtd -sudo service libvirtd restart +install_packages +build_box |