diff --git a/virtualization/vagrant/Vagrantfile b/virtualization/vagrant/Vagrantfile index e50c4e6de00..d3974d51a7a 100644 --- a/virtualization/vagrant/Vagrantfile +++ b/virtualization/vagrant/Vagrantfile @@ -13,4 +13,12 @@ Vagrant.configure(2) do |config| vb.cpus = 2 vb.customize ['modifyvm', :id, '--memory', '1024'] end + config.vm.provider :hyperv do |h, override| + override.vm.box = "generic/debian9" + override.vm.hostname = "contrib-stretch" + h.vmname = "home-assistant" + h.cpus = 2 + h.memory = 1024 + h.maxmemory = 1024 + end end diff --git a/virtualization/vagrant/provision.bat b/virtualization/vagrant/provision.bat new file mode 100644 index 00000000000..c8174e939a1 --- /dev/null +++ b/virtualization/vagrant/provision.bat @@ -0,0 +1,50 @@ +@echo off +call:main %* +goto:eof + +:usage +echo.############################################################ +echo. +echo.Use `./provision.bat` to interact with HASS. E.g: +echo. +echo.- setup the environment: `./provision.bat start` +echo.- restart HASS process: `./provision.bat restart` +echo.- run test suit: `./provision.bat tests` +echo.- destroy the host and start anew: `./provision.bat recreate` +echo. +echo.Official documentation at https://home-assistant.io/docs/installation/vagrant/ +echo. +echo.############################################################' +goto:eof + +:main +if "%*"=="setup" ( + if exist setup_done del setup_done + vagrant up --provision + copy /y nul setup_done +) else ( +if "%*"=="tests" ( + copy /y nul run_tests + vagrant provision +) else ( +if "%*"=="restart" ( + copy /y nul restart + vagrant provision +) else ( +if "%*"=="start" ( + vagrant up --provision +) else ( +if "%*"=="stop" ( + vagrant halt +) else ( +if "%*"=="destroy" ( + vagrant destroy -f +) else ( +if "%*"=="recreate" ( + if exist setup_done del setup_done + if exist restart del restart + vagrant destroy -f + vagrant up --provision +) else ( + call:usage +))))))) diff --git a/virtualization/vagrant/provision.sh b/virtualization/vagrant/provision.sh index d4ef4e0b446..1d2eecddc73 100755 --- a/virtualization/vagrant/provision.sh +++ b/virtualization/vagrant/provision.sh @@ -76,6 +76,10 @@ run_tests() { rsync -a --delete \ --exclude='*.tox' \ --exclude='*.git' \ + --exclude='.vagrant' \ + --exclude='lib64' \ + --exclude='bin/python' \ + --exclude='bin/python3' \ /home-assistant/ /home-assistant-tests/ cd /home-assistant-tests && tox || true echo '############################################################'