apt-get install debootstrap
cd /var/lib/vz/private
debootstrap etch etch-temp http://debian.oregonstate.edu/debian/
chroot etch-temp
cat <<EOF > /etc/apt/sources.list
deb http://debian.oregonstate.edu/debian etch main contrib
deb http://security.debian.org etch/updates main contrib
EOF
apt-get update
apt-get upgrade
apt-get install ssh quota
chmod 700 /root
usermod -L root
sed -i -e '/getty/d' /etc/inittab
sed -i -e 's@\([[:space:]]\)\(/var/log/\)@\1-\2@' /etc/syslog.conf
rm -f /etc/mtab
ln -s /proc/mounts /etc/mtab
update-rc.d -f klogd remove
rm -f /etc/ssh/ssh_host_*
cat << EOF > /etc/rc2.d/S15ssh_gen_host_keys
#!/bin/bash
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''
rm -f \$0
EOF
chmod a+x /etc/rc2.d/S15ssh_gen_host_keys
apt-get clean
exit
cd etch-temp
tar -zcf ../../template/cache/debian-4.0-i386-basic.tar.gz *
cd ..
rm -Rf etch-temp
cd /root
vzctl create 12345 --ostemplate=debian-4.0-i386-basic