diff options
author | Guo Ruijing <ruijing.guo@intel.com> | 2017-12-05 04:41:13 -0800 |
---|---|---|
committer | Guo Ruijing <ruijing.guo@intel.com> | 2017-12-05 05:53:52 -0800 |
commit | 613d576521a1c1e524c3becda05a7ea5db4bc906 (patch) | |
tree | 52205a23bd2036f39d10452f6428f3ec63384987 /src/vagrant/setup_vagrant.sh | |
parent | d1c5fe6321b7c8d7ae6c1c877ba9843b531b3e32 (diff) |
update setup vagrant
1. add copyright
2. don't build box in default
Change-Id: I2add34fda56a3d9553fbd5a902ab4e23ad1ab40c
Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
Diffstat (limited to 'src/vagrant/setup_vagrant.sh')
-rwxr-xr-x | src/vagrant/setup_vagrant.sh | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/src/vagrant/setup_vagrant.sh b/src/vagrant/setup_vagrant.sh index 00b684e..2dc5ae0 100755 --- a/src/vagrant/setup_vagrant.sh +++ b/src/vagrant/setup_vagrant.sh @@ -1,9 +1,28 @@ #!/bin/bash +# +# Copyright (c) 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# set -ex DIR="$(dirname `readlink -f $0`)" +usage() { + echo "Usage: $0 -b virtualbox|libvirt" +} + install_packages() { cat << EOF | sudo tee /etc/sudoers.d/${USER} @@ -51,7 +70,7 @@ build_virtualbox() { vagrant box add opnfv/container4nfv ../builds/ubuntu-16.04.virtualbox.box } -build_kvmbox() { +build_libvirtbox() { cd $DIR/bento/ubuntu ../packer build -var 'headless=true' -only=qemu ubuntu-16.04-amd64.json vagrant box remove -f opnfv/container4nfv.kvm --all || true @@ -59,6 +78,21 @@ build_kvmbox() { } install_packages -install_box_builder -build_virtualbox -build_kvmbox + +set +x +while getopts "b:h" OPTION; do + case $OPTION in + b) + if [ ${OPTARG} == "virtualbox" ]; then + install_box_builder + build_virtualbox + elif [ ${OPTARG} == "libvirt" ]; then + install_box_builder + build_libvirtbox + fi + ;; + h) + usage; + ;; + esac +done |