#!/bin/bash
set -x

#Let's create a minimal kickstart file with serial console enabled
cat << EOF > fed.ks
install
text
reboot
lang en_US.UTF-8
keyboard us
network --bootproto dhcp
rootpw testpwd
firewall --enabled --ssh
selinux --enforcing
timezone --utc America/New_York
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH serial text"
zerombr
clearpart --all --initlabel
autopart

%packages
@core
%end
EOF

#Create the nested-guest
virt-install --connect=qemu:///system \
    --network=bridge:virbr0 \
    --initrd-inject=/root/nested-test/fed.ks \
    --extra-args="ks=file:/fed.ks console=tty0 console=ttyS0,115200 serial rd_NO_PLYMOUTH" \
    --name=nested-guest \
    --disk path=/var/lib/libvirt/images/nested-guest.img,size=10 \
    --ram 2048 \
    --vcpus=3 \
    --check-cpu \
    --hvm \
    --location=http://download.foo.bar.com/pub/fedora/linux/releases/16/Fedora/x86_64/os/ \
    --nographics 

