[buildout]
extends =
  ../file/buildout.cfg
  ../openssh/buildout.cfg
  ../p7zip/buildout.cfg
  ../qemu-kvm/buildout.cfg

parts = vm-debian

[vm-run-environment]
PATH = ${openssh:location}/bin:${qemu:location}/bin:%(PATH)s

[vm-install-environment]
PATH = ${file:location}/bin:${p7zip:location}/bin:${vm-run-environment:PATH}

[vm-run-base]
recipe = slapos.recipe.build:vm.run
environment = vm-run-environment
vm = ${vm-debian:location}
dist = ${vm-debian:dists}
wait-ssh = 100

[vm-debian]
recipe = slapos.recipe.build:vm.install-debian
environment = vm-install-environment
dists = debian-stable
size = 1Gi
late-command =
# rdnssd causes too much trouble with recent QEMU, because the latter acts as
# a DNS proxy on both IPv4 and IPv6 without translating queries to what the
# host supports.
  dpkg -P rdnssd
  [ $DIST != debian-squeeze ] || {
# Squeeze kernel (2.6.32) is too old for 9p mount points.
    set squeeze-backports /etc/apt/sources.list.d/backports.list `
      aptitude -F %p search '?source-package("^linux-latest-2.6$")~i'`
    echo 'Acquire::Check-Valid-Until "false";' >/etc/apt/apt.conf.d/00AcceptExpired
    echo deb http://archive.debian.org/debian-backports/ $1 main >$2
    apt-get update --no-list-cleanup -o Dir::Etc::SourceList=/dev/null
    apt-get install -y -t $1 $3
  }
  mount |grep -q 'on / .*\bdiscard\b' || ! type fstrim || {
    apt-get clean
    sync
    fstrim -v /
  }
debconf.debconf =
  debconf/frontend noninteractive
  debconf/priority critical
debian-squeeze/preseed.mirror/country = manual
debian-squeeze/preseed.mirror/http/hostname = archive.debian.org
debian-squeeze/preseed.mirror/http/directory = /debian
debian-wheezy/preseed.mirror/country = manual
debian-wheezy/preseed.mirror/http/hostname = archive.debian.org
debian-wheezy/preseed.mirror/http/directory = /debian
debian-jessie/preseed.mirror/country = manual
debian-jessie/preseed.mirror/http/hostname = archive.debian.org
debian-jessie/preseed.mirror/http/directory = /debian
# minimal size
preseed.apt-setup/enable-source-repositories = false
preseed.recommends = false
preseed.tasks =

[debian-stable]
x86_64.iso = debian-amd64-netinst.iso
x86_64.kernel = install.amd/vmlinuz
x86_64.initrd = install.amd/initrd.gz

[debian-testing]
<= debian-stable
x86_64.iso = debian-amd64-testing-netinst.iso

[debian-squeeze]
<= debian-stable
x86_64.iso = debian-amd64-squeeze-netinst.iso

[debian-wheezy]
<= debian-stable
x86_64.iso = debian-amd64-wheezy-netinst.iso

[debian-jessie]
<= debian-stable
x86_64.iso = debian-amd64-jessie-netinst.iso

[debian-stretch]
<= debian-stable
x86_64.iso = debian-amd64-stretch-netinst.iso

[debian-buster]
<= debian-stable

[debian-bullseye]
<= debian-testing
