scripts/vagrant: cleanup packaging routine

Add "halt" command before packaging, it's needed for this
process. Destroy the VM once it's packaged as we have no
further use for it.

Move provision-related commands to update.sh.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: Ib8041df023b80b4cd5fbad734481eb6bd4ffc21c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1154
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
This commit is contained in:
Karol Latecki 2020-03-05 09:10:51 +01:00 committed by Tomasz Zawadzki
parent 5277a5324e
commit 2a75be1a56
2 changed files with 6 additions and 11 deletions

View File

@ -291,21 +291,12 @@ EOF
fi
vagrant up $provider
if [ ${VAGRANT_PACKAGE_BOX} == 1 ]; then
cd "$VAGRANTFILE_DIR"
vagrant ssh -c 'sudo spdk_repo/spdk/scripts/vagrant/update.sh'
if [[ $SPDK_VAGRANT_DISTRO =~ "ubuntu" ]]; then
vagrant ssh -c 'sudo apt-get clean'
elif [[ $SPDK_VAGRANT_DISTRO =~ "fedora" ]]; then
vagrant ssh -c 'sudo dnf clean all'
elif [[ $SPDK_VAGRANT_DISTRO =~ "centos" ]]; then
vagrant ssh -c 'sudo yum clean all'
elif [[ $SPDK_VAGRANT_DISTRO =~ "freebsd" ]]; then
vagrant ssh -c 'sudo pkg clean -ay'
fi
vagrant ssh -c 'cat /dev/null > ~/.bash_history && history -c'
vagrant halt
vagrant package --output spdk_${SPDK_VAGRANT_DISTRO}.box
vagrant box add spdk/${SPDK_VAGRANT_DISTRO} spdk_${SPDK_VAGRANT_DISTRO}.box &&
rm spdk_${SPDK_VAGRANT_DISTRO}.box
vagrant destroy
fi
echo ""
echo " SUCCESS!"

View File

@ -80,15 +80,19 @@ else
apt-get update --assume-yes --no-install-suggests --no-install-recommends -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"
apt-get upgrade --assume-yes --no-install-suggests --no-install-recommends -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"
${SPDK_DIR}/scripts/pkgdep.sh --all
apt-get clean
elif [ "$DISTRIB_ID" == "CentOS" ]; then
# Standard update + upgrade dance
yum check-update
yum update -y
${SPDK_DIR}/scripts/pkgdep.sh --all
yum clean all
elif [ "$DISTRIB_ID" == "Fedora" ]; then
yum check-update
yum update -y
"$SPDK_DIR"/scripts/pkgdep.sh --all
sudo -u vagrant "$SPDK_DIR"/test/common/config/vm_setup.sh -i
yum clean all
fi
cat /dev/null > ~/.bash_history && history -c
fi