blob: 1d9ec5e2585f41b1d124ff4c9e97888c587018d8 [file] [log] [blame]
Renuka Apte4c889342012-03-08 13:15:03 -08001#!/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 Apte668d9cb2012-04-11 11:42:54 -07008BASE_DIR=$(cd $(dirname "$0") && pwd)
9source $BASE_DIR/../../../localrc
10
Renuka Apte4c889342012-03-08 13:15:03 -080011LENNY=$(xe template-list name-label=Debian\ Lenny\ 5.0\ \(32-bit\) --minimal)
12
13if [[ -z $LENNY ]] ; then
14 echo "Cant find lenny 32bit template, is this on 6.0.2?"
15 exit 1
16fi
17
18distro="Ubuntu 11.10"
19arches=("32-bit" "64-bit")
20
Renuka Apte360e29b2012-04-09 16:24:53 -070021preseedurl=${1:-"http://images.ansolabs.com/devstackubuntupreseed.cfg"}
Renuka Apte4c889342012-03-08 13:15:03 -080022
23for 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 Apte668d9cb2012-04-11 11:42:54 -070028 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 Apte4c889342012-03-08 13:15:03 -080039 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 Apte668d9cb2012-04-11 11:42:54 -070042 PV-args="$pvargs" \
Renuka Apte4c889342012-03-08 13:15:03 -080043 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
53done
54
55echo "Done"