#!/bin/sh

exec 2>&1
set -ex

# Skip test if it is executed in a non amd64 architecture
if [ $(dpkg --print-architecture) != 'amd64' ]; then
  exit 77
fi

vagrant --version
vagrant global-status
vagrant box list

stable=$(debian-distro-info --stable)

mkdir testbox
cd testbox

cleanup() {
  vagrant halt
  vagrant destroy -f
  cd ..
  rm -rf testbox
}
trap cleanup INT TERM EXIT

vagrant init debian/${stable}64
vagrant up
vagrant status
vagrant ssh -- true
vagrant ssh -- sudo --non-interactive true
vagrant ssh -- cat /etc/debian_version
