3 # The script used to install guests on RHEL 5 Xen.
5 # NB: You have to run this script on the RHEL 5 Xen host itself.
6 if ! uname -a | grep -sq 'el5xen'; then
7 echo "$0: You must run this on RHEL 5 Xen host"
12 echo "$0 major minor arch pv|fv"
16 # Ancient RHEL versions didn't work very well headless. I cannot
17 # get RHEL 4 to install at all.
18 if [ "$DISPLAY" = "" ]; then
19 echo "$0: DISPLAY variable is not set"
27 name=rhel_${major}${minor}_${arch}_${pvfv}
31 tree=http://tock/download/released/RHEL-$major/U$minor/AS/$arch/tree
34 tree=http://tock/download/released/RHEL-$major/U$minor/AS/$arch/tree
37 tree=http://tock/download/released/RHEL-$major-Server/U$minor/$arch/os
40 # https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Virtualization/chap-RHEL6_On_RHEL5.html
41 # In theory the paravirt-opts RHEL 6 kernel should be
42 # installable as a PV guest on RHEL 5 Xen, but I could not
44 tree=http://tock/download/released/RHEL-$major/$major.$minor/Server/$arch/os
47 echo "$0: $major.$minor not supported yet"
55 pvfv_option=--paravirt
61 echo "$0: the fourth parameter must be [pv|fv]"
65 # Create the kickstart.
67 # RHEL 5 didn't have virt-install --initrd-inject, so the following
68 # only works because I have a webserver and an NFS server which map
70 webserver=http://192.168.0.249/scratch
71 nfsserver=/mnt/scratch
72 ks=$(mktemp -p $nfsserver)
79 network --bootproto dhcp
81 firewall --enabled --ssh
82 timezone --utc America/New_York
85 if [ $major -ge 4 ]; then
86 echo "selinux --enforcing" >> $ks
87 echo "poweroff" >> $ks
90 # This doesn't work on RHEL 5. Didn't check RHEL 6 yet.
91 #if [ $major -ge 5 ]; then
92 # echo "hostname $name" >> $ks
98 clearpart --all --initlabel
101 xconfig --defaultdesktop=GNOME
111 ks_url="$webserver/`basename $ks`"
115 echo Creating the output disk ...
116 output=/mnt/fastscratch/$name.img
118 dd if=/dev/zero of=$output bs=1 count=0 seek=6G
120 virsh destroy $name ||:
121 virsh undefine $name ||:
125 echo Running virt-install ...
131 --os-type=linux --os-variant=rhel$major \
134 --extra-args="ks=$ks_url"
136 virsh dumpxml $name > /mnt/fastscratch/$name.xml
138 echo Output written to /mnt/fastscratch:
139 ls -l /mnt/fastscratch/$name*