Renuka Apte | 4c88934 | 2012-03-08 13:15:03 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | ## makeubuntu.sh, this creates Ubuntu server 11.10 32 and 64 bit templates |
| 3 | ## on Xenserver 6.0.2 Net install only |
| 4 | ## Original Author: David Markey <david.markey@citrix.com> |
| 5 | ## Author: Renuka Apte <renuka.apte@citrix.com> |
| 6 | ## This is not an officially supported guest OS on XenServer 6.02 |
| 7 | |
Renuka Apte | 668d9cb | 2012-04-11 11:42:54 -0700 | [diff] [blame] | 8 | BASE_DIR=$(cd $(dirname "$0") && pwd) |
| 9 | source $BASE_DIR/../../../localrc |
| 10 | |
Renuka Apte | 4c88934 | 2012-03-08 13:15:03 -0800 | [diff] [blame] | 11 | LENNY=$(xe template-list name-label=Debian\ Lenny\ 5.0\ \(32-bit\) --minimal) |
| 12 | |
| 13 | if [[ -z $LENNY ]] ; then |
| 14 | echo "Cant find lenny 32bit template, is this on 6.0.2?" |
| 15 | exit 1 |
| 16 | fi |
| 17 | |
| 18 | distro="Ubuntu 11.10" |
| 19 | arches=("32-bit" "64-bit") |
| 20 | |
Renuka Apte | 360e29b | 2012-04-09 16:24:53 -0700 | [diff] [blame] | 21 | preseedurl=${1:-"http://images.ansolabs.com/devstackubuntupreseed.cfg"} |
Renuka Apte | 4c88934 | 2012-03-08 13:15:03 -0800 | [diff] [blame] | 22 | |
| 23 | for arch in ${arches[@]} ; do |
| 24 | echo "Attempting $distro ($arch)" |
| 25 | if [[ -n $(xe template-list name-label="$distro ($arch)" params=uuid --minimal) ]] ; then |
| 26 | echo "$distro ($arch)" already exists, Skipping |
| 27 | else |
Renuka Apte | 668d9cb | 2012-04-11 11:42:54 -0700 | [diff] [blame] | 28 | if [ -z $NETINSTALLIP ] |
| 29 | then |
| 30 | echo "NETINSTALLIP not set in localrc" |
| 31 | exit 1 |
| 32 | fi |
| 33 | pvargs="-- quiet console=hvc0 partman/default_filesystem=ext3 locale=en_US console-setup/ask_detect=false keyboard-configuration/layoutcode=us netcfg/choose_interface=eth3 netcfg/get_hostname=os netcfg/get_domain=os auto url=${preseedurl}" |
| 34 | if [ "$NETINSTALLIP" != "dhcp" ] |
| 35 | then |
| 36 | netcfgargs="netcfg/disable_autoconfig=true netcfg/get_nameservers=${NAMESERVERS} netcfg/get_ipaddress=${NETINSTALLIP} netcfg/get_netmask=${NETMASK} netcfg/get_gateway=${GATEWAY} netcfg/confirm_static=true" |
| 37 | pvargs="${pvargs} ${netcfgargs}" |
| 38 | fi |
Renuka Apte | 4c88934 | 2012-03-08 13:15:03 -0800 | [diff] [blame] | 39 | NEWUUID=$(xe vm-clone uuid=$LENNY new-name-label="$distro ($arch)") |
| 40 | xe template-param-set uuid=$NEWUUID other-config:install-methods=http,ftp \ |
| 41 | other-config:install-repository=http://archive.ubuntu.net/ubuntu \ |
Renuka Apte | 668d9cb | 2012-04-11 11:42:54 -0700 | [diff] [blame] | 42 | PV-args="$pvargs" \ |
Renuka Apte | 4c88934 | 2012-03-08 13:15:03 -0800 | [diff] [blame] | 43 | other-config:debian-release=oneiric \ |
| 44 | other-config:default_template=true |
| 45 | |
| 46 | if [[ "$arch" == "32-bit" ]] ; then |
| 47 | xe template-param-set uuid=$NEWUUID other-config:install-arch="i386" |
| 48 | else |
| 49 | xe template-param-set uuid=$NEWUUID other-config:install-arch="amd64" |
| 50 | fi |
| 51 | echo "Success" |
| 52 | fi |
| 53 | done |
| 54 | |
| 55 | echo "Done" |