makeubuntu.sh
#!/bin/bash
## makeubuntu.sh, this creates Ubuntu server 10.04 32 and 64 bit templates on Xenserver 5.6. Net install only
## Author: David Markey
## This is not an officially supported guest OS on XenServer 5.6
LENNY=$(xe template-list name-label=Debian\ Lenny\ 5.0\ \(32-bit\) --minimal)
if [[ -z $LENNY ]] ; then
echo "Cant find lenny 32bit template, is this on 5.6?"
exit 1
fi
distro="Ubuntu 10.04"
arches=("32-bit" "64-bit")
for arch in ${arches[@]} ; do
echo "Attempting $distro ($arch)"
if [[ -n $(xe template-list name-label="$distro ($arch)" params=uuid --minimal) ]] ; then
echo "$distro ($arch)" already exists, Skipping
else
NEWUUID=$(xe vm-clone uuid=$LENNY new-name-label="$distro ($arch)")
xe template-param-set uuid=$NEWUUID other-config:install-methods=http,ftp \
other-config:install-repository=http://archive.ubuntu.net/ubuntu \
PV-args="-- quiet console=hvc0 partman/default_filesystem=ext3" \
other-config:debian-release=lucid \
other-config:default_template=true
if [[ "$arch" == "32-bit" ]] ; then
xe template-param-set uuid=$NEWUUID other-config:install-arch="i386"
else
xe template-param-set uuid=$NEWUUID other-config:install-arch="amd64"
fi
echo "Success"
fi
done
echo "Done"
Nota: M'ha estat complicat trobar l'enllaç d'on vaig treure aquest script, així que prego disculpes al creador del mateix per no oferir l'origen.