#!/bin/bash

arch="armhf"
dest="/opt/ltsp/${arch}"
#mirror="file:///home/vagrant/public_html/debian/"
mirror="file:///opt/ltsp/debian/"

# set up video
for output in LVDS1 VGA1 ; do
  xrandr --output $output --mode 800x600 || true
done

# ensure the directory isn't already there
sudo rm -rf ${dest}

# display something to the audience
echo ' debootstrap
 qemu-user-static 
 binfmt-support ' | sm - &

set -x
# build chroot
time \
sudo qemu-debootstrap \
  --variant=minbase --no-check-gpg \
  --arch=${arch} \
  sid \
  ${dest} \
  ${mirror}

# display some weird results
sudo chroot ${dest} uname -a
sudo chroot ${dest} dpkg --print-architecture

set +x
# ensure the directory isn't already there
sudo rm -rf ${dest}

