Page MenuHomePhorge

No OneTemporary

Authored By
Unknown
Size
16 KB
Referenced Files
None
Subscribers
None
diff --git a/vms/bin/setup-kolab-vm b/vms/bin/setup-kolab-vm
index d895bd2..d2267ea 100755
--- a/vms/bin/setup-kolab-vm
+++ b/vms/bin/setup-kolab-vm
@@ -1,424 +1,422 @@
#!/bin/bash
function usage() {
echo "Usage: $0 <version> <distribution> [options]"
echo ""
echo "Options:"
echo ""
echo " [--size \$xG]"
echo " [--suffix <suffix>]"
exit 1
}
size=12G
mem=1024
if [ ! -d "${TMPDIR:-/tmp}/stick.git" ]; then
git clone https://git.kolab.org/diffusion/QA/stick.git ${TMPDIR:-/tmp}/stick.git
else
pushd ${TMPDIR:-/tmp}/stick.git
git remote set-url origin https://git.kolab.org/diffusion/QA/stick.git
git fetch origin
git reset --hard origin/master
popd
fi
while [ $# -gt 0 ]; do
case $1 in
24)
ver="24"
shift
;;
30)
ver="30"
shift
;;
31)
ver="31"
shift
;;
32)
ver="32"
shift
;;
33)
ver="33"
shift
;;
34)
ver="34"
shift
;;
dev)
ver="dev"
shift
;;
130)
ver="130"
shift
;;
140)
ver="140"
shift
;;
##
## Red Hat Enterprise Linux / CentOS
##
tikanga)
[ -z "${ver}" ] && usage
dist="tikanga"
- mirror_location="http://ftp.nluug.nl/pub/os/Linux/distr/CentOS/5/os/x86_64/"
+ mirror_location="http://mirror.switch.ch/ftp/mirror/centos/5/os/x86_64/"
extra_opts="ks=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}.cfg"
shift
;;
santiago)
[ -z "${ver}" ] && usage
dist="santiago"
- mirror_location="http://mirror.bytemark.co.uk/centos/6/os/x86_64/"
- mirror_location="http://ftp.nluug.nl/pub/os/Linux/distr/CentOS/6/os/x86_64/"
+ mirror_location="http://mirror.switch.ch/ftp/mirror/centos/6/os/x86_64/"
extra_opts="ks=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}.cfg"
shift
;;
maipo)
[ -z "${ver}" ] && usage
dist="maipo"
- mirror_location="http://mirror.bytemark.co.uk/centos/7/os/x86_64/"
- mirror_location="http://ftp.nluug.nl/pub/os/Linux/distr/CentOS/7/os/x86_64/"
+ mirror_location="http://mirror.switch.ch/ftp/mirror/centos/7/os/x86_64/"
extra_opts="ks=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}.cfg"
shift
;;
##
## Fedora
##
beefymiracle)
[ -z "${ver}" ] && usage
dist="beefymiracle"
- mirror_location="http://ftp.nluug.nl/pub/os/Linux/distr/fedora/linux/releases/17/Fedora/x86_64/os/"
+ mirror_location="http://mirror.switch.ch/ftp/mirror/fedora/linux/releases/17/Fedora/x86_64/os/"
extra_opts="ks=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}.cfg"
shift
;;
sphericalcow)
[ -z "${ver}" ] && usage
dist="sphericalcow"
- mirror_location="http://ftp.nluug.nl/pub/os/Linux/distr/fedora/linux/releases/18/Fedora/x86_64/os/"
+ mirror_location="http://mirror.switch.ch/ftp/mirror/fedora/linux/releases/18/Fedora/x86_64/os/"
extra_opts="ks=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}.cfg"
shift
;;
schroedingerscat)
[ -z "${ver}" ] && usage
dist="schroedingerscat"
- mirror_location="http://ftp.nluug.nl/pub/os/Linux/distr/fedora/linux/releases/19/Fedora/x86_64/os/"
+ mirror_location="http://mirror.switch.ch/ftp/mirror/fedora/linux/releases/19/Fedora/x86_64/os/"
extra_opts="ks=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}.cfg"
shift
;;
- heisenburg)
+ heisenbug)
[ -z "${ver}" ] && usage
- dist="heisenburg"
- mirror_location="http://download.fedoraproject.org/pub/fedora/linux/releases/20/Fedora/x86_64/os/"
+ dist="heisenbug"
+ mirror_location="http://mirror.switch.ch/ftp/mirror/fedora/linux/releases/20/Fedora/x86_64/os/"
extra_opts="ks=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}.cfg"
shift
;;
rawhide)
[ -z "${ver}" ] && usage
dist="rawhide"
- mirror_location="http://ftp.nluug.nl/pub/os/Linux/distr/fedora/linux/releases/17/Fedora/x86_64/os/"
+ mirror_location="http://mirror.switch.ch/ftp/mirror/fedora/linux/releases/17/Fedora/x86_64/os/"
extra_opts="ks=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}.cfg"
shift
;;
##
## openSUSE
##
dartmouth)
[ -z "${ver}" ] && usage
dist="dartmouth"
mirror_location="http://download.opensuse.org/distribution/12.3/repo/oss/"
shift
;;
##
## Debian
##
squeeze)
[ -z "${ver}" ] && usage
dist="squeeze"
mirror_location="http://mirror.kolabsys.com/distr/debian/dists/squeeze/main/installer-amd64/"
mirror_location="http://ftp.debian.org/debian/dists/squeeze/main/installer-amd64/"
extra_opts="priority=critical locale=en_US console-keymaps-at/keymap=us interface=auto hostname=kolab.example.org domain=example.org auto url=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}.cfg"
shift
;;
wheezy)
[ -z "${ver}" ] && usage
dist="wheezy"
mirror_location="http://mirror.kolabsys.com/distr/debian/dists/wheezy/main/installer-amd64/"
mirror_location="http://ftp.debian.org/debian/dists/wheezy/main/installer-amd64/"
extra_opts="priority=critical locale=en_US console-keymaps-at/keymap=us keyboard-configuration/xkb-keymap=us interface=auto hostname=kolab.example.org domain=example.org auto url=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}.cfg"
shift
;;
jessie)
[ -z "${ver}" ] && usage
dist="jessie"
mirror_location="http://mirror.kolabsys.com/distr/debian/dists/jessie/main/installer-amd64/"
mirror_location="http://ftp.debian.org/debian/dists/jessie/main/installer-amd64/"
extra_opts="priority=critical locale=en_US console-keymaps-at/keymap=us keyboard-configuration/xkb-keymap=us interface=auto hostname=kolab.example.org domain=example.org auto url=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}.cfg"
shift
;;
sid)
[ -z "${ver}" ] && usage
dist="sid"
mirror_location="http://mirror.kolabsys.com/distr/debian/dists/sid/main/installer-amd64/"
mirror_location="http://ftp.uk.debian.org/debian/dists/sid/main/installer-amd64/"
extra_opts="priority=critical locale=en_US console-keymaps-at/keymap=us keyboard-configuration/xkb-keymap=us interface=auto hostname=kolab.example.org domain=example.org auto url=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}.cfg"
shift
;;
##
## Ubuntu
##
precise)
[ -z "${ver}" ] && usage
dist="precise"
mirror_location="http://mirror.kolabsys.com/distr/ubuntu/dists/precise/main/installer-amd64/"
mirror_location="http://mirror.krystal.co.uk/ubuntu/dists/precise/main/installer-amd64/"
extra_opts="priority=critical locale=en_US console-keymaps-at/keymap=us interface=auto hostname=kolab.example.org domain=example.org auto url=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}.cfg"
shift
;;
quantal)
[ -z "${ver}" ] && usage
dist="quantal"
mirror_location="http://mirror.kolabsys.com/distr/ubuntu/dists/quantal/main/installer-amd64/"
mirror_location="http://mirror.krystal.co.uk/ubuntu/dists/quantal/main/installer-amd64/"
extra_opts="priority=critical locale=en_US console-keymaps-at/keymap=us interface=auto hostname=kolab.example.org domain=example.org auto url=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}.cfg"
shift
;;
raring)
[ -z "${ver}" ] && usage
dist="raring"
mirror_location="http://mirror.kolabsys.com/distr/ubuntu/dists/raring/main/installer-amd64/"
mirror_location="http://mirror.krystal.co.uk/ubuntu/dists/raring/main/installer-amd64/"
extra_opts="priority=critical locale=en_US console-keymaps-at/keymap=us interface=auto hostname=kolab.example.org domain=example.org auto url=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}.cfg"
shift
;;
saucy)
[ -z "${ver}" ] && usage
dist="saucy"
mirror_location="http://mirror.kolabsys.com/distr/ubuntu/dists/saucy/main/installer-amd64/"
mirror_location="http://mirror.krystal.co.uk/ubuntu/dists/saucy/main/installer-amd64/"
extra_opts="priority=critical locale=en_US console-keymaps-at/keymap=us interface=auto hostname=kolab.example.org domain=example.org auto url=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}.cfg"
shift
;;
trusty)
[ -z "${ver}" ] && usage
dist="trusty"
mirror_location="http://mirror.kolabsys.com/distr/ubuntu/dists/trusty/main/installer-amd64/"
mirror_location="http://mirror.krystal.co.uk/ubuntu/dists/trusty/main/installer-amd64/"
extra_opts="priority=critical locale=en_US console-keymaps-at/keymap=us interface=auto hostname=kolab.example.org domain=example.org auto url=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}.cfg"
shift
;;
--32bit)
arch=i686
shift;
;;
--memory)
mem=$2
shift; shift
;;
--network)
network="--network='$2'"
shift; shift
;;
--size)
size=$2
shift; shift
;;
--suffix)
suffix=$2
shift; shift
;;
*)
usage
;;
esac
done
if [ -z "${network}" ]; then
network="--network='bridge=virbr0'"
fi
if [ ! -z "${suffix}" ]; then
_suffix="-${suffix}"
fi
case ${dist} in
- beefymiracle|sphericalcow|schroederingerscat|heisenburg|santiago|maipo)
+ beefymiracle|sphericalcow|schroederingerscat|heisenbug|santiago|maipo)
if [ -f "${TMPDIR:-/tmp}/stick.git/vms/autoinstall/${dist}-${ver}-${suffix}.cfg" ]; then
extra_opts="ks=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}-${suffix}.cfg"
fi
;;
wheezy)
if [ -f "${TMPDIR:-/tmp}/stick.git/vms/autoinstall/${dist}-${ver}-${suffix}.cfg" ]; then
extra_opts="priority=critical locale=en_US console-keymaps-at/keymap=us keyboard-configuration/xkb-keymap=us interface=auto hostname=kolab.example.org domain=example.org auto url=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}-${suffix}.cfg"
fi
;;
precise)
if [ -f "${TMPDIR:-/tmp}/stick.git/vms/autoinstall/${dist}-${ver}-${suffix}.cfg" ]; then
extra_opts="priority=critical locale=en_US console-keymaps-at/keymap=us keyboard-configuration/xkb-keymap=us interface=auto hostname=kolab.example.org domain=example.org auto url=http://cgit.kolab.org/stick/plain/vms/autoinstall/${dist}-${ver}-${suffix}.cfg"
fi
;;
esac
if [ "${ver}" == "130" ]; then
extra_opts=$(echo ${extra_opts} | sed -e "s/\-${suffix}.cfg/\-empty.cfg/g")
elif [ "${ver}" == "140" ]; then
extra_opts=$(echo ${extra_opts} | sed -e "s/\-${suffix}.cfg/\-empty.cfg/g")
fi
sed -i -e '/^kolab.example.org/d' -e '/^192.168.122./d' ~/.ssh/known_hosts
if [ "${dist}" == "tikanga" ]; then
if [ -f ${TMPDIR:-/tmp}/CentOS-5.8-x86_64-minimal.iso ]; then
minimal_disk="--disk=path=${TMPDIR:-/tmp}/CentOS-5.8-x86_64-minimal.iso,device=cdrom"
fi
if [ -f ${TMPDIR:-/tmp}/CentOS-5.8-x86_64-netinstall.iso ]; then
netinstall_disk="--disk=path=${TMPDIR:-/tmp}/CentOS-5.8-x86_64-netinstall.iso,device=cdrom"
fi
if [ -f ${TMPDIR:-/tmp}/CentOS-5.8-x86_64-bin-DVD-1of2.iso ]; then
minimal_disk=""
netinstall_disk=""
dvd1_disk="--disk=path=${TMPDIR:-/tmp}/CentOS-5.8-x86_64-bin-DVD-1of2.iso,device=cdrom"
[ -f ${TMPDIR:-/tmp}/CentOS-5.8-x86_64-bin-DVD-2of2.iso ] && \
dvd2_disk="--disk=path=${TMPDIR:-/tmp}/CentOS-5.8-x86_64-bin-DVD-2of2.iso,device=cdrom"
fi
elif [ "${dist}" == "santiago" ]; then
if [ -f ${TMPDIR:-/tmp}/CentOS-6.4-x86_64-minimal.iso ]; then
minimal_disk="--disk=path=${TMPDIR:-/tmp}/CentOS-6.4-x86_64-minimal.iso,device=cdrom"
fi
if [ -f ${TMPDIR:-/tmp}/CentOS-6.4-x86_64-netinstall.iso ]; then
netinstall_disk="--disk=path=${TMPDIR:-/tmp}/CentOS-6.4-x86_64-netinstall.iso,device=cdrom"
fi
if [ -f ${TMPDIR:-/tmp}/CentOS-6.4-x86_64-bin-DVD1.iso ]; then
minimal_disk=""
netinstall_disk=""
dvd1_disk="--disk=path=${TMPDIR:-/tmp}/CentOS-6.4-x86_64-bin-DVD1.iso,device=cdrom"
[ -f ${TMPDIR:-/tmp}/CentOS-6.4-x86_64-bin-DVD2.iso ] && \
dvd2_disk="--disk=path=${TMPDIR:-/tmp}/CentOS-6.4-x86_64-bin-DVD2.iso,device=cdrom"
fi
elif [ "${dist}" == "maipo" ]; then
if [ -f ${TMPDIR:-/tmp}/CentOS-7.0-1406-x86_64-DVD.iso ]; then
minimal_disk=""
netinstall_disk=""
dvd1_disk="--disk=path=${TMPDIR:-/tmp}/CentOS-7.0-1406-x86_64-DVD.iso,device=cdrom"
fi
#elif [ "${dist}" == "wheezy" ]; then
# if [ -f ${TMPDIR:-/tmp}/debian-wheezy-DI-b3-amd64-netinst.iso ]; then
# netinstall_disk="--disk=path=${TMPDIR:-/tmp}/debian-wheezy-DI-b3-amd64-netinst.iso,device=cdrom"
# unset mirror_location
# fi
fi
echo -n "Destroying virtual machine kolab-${dist}-${ver}${_suffix}... "
sudo virsh destroy "kolab-${dist}-${ver}${_suffix}" >/dev/null 2>&1
echo "DONE."
echo -n "Undefining virtual machine kolab-${dist}-${ver}${_suffix}... "
sudo virsh undefine "kolab-${dist}-${ver}${_suffix}" >/dev/null 2>&1
echo "DONE."
echo -n "Removing virtual machine disk image... "
sudo rm -rf ${TMPDIR:-/tmp}/kolab-${dist}-${ver}${_suffix}.qcow2 >/dev/null 2>&1
echo "DONE."
echo -n "Creating virtual machine disk image... "
sudo qemu-img create -f qcow2 ${TMPDIR:-/tmp}/kolab-${dist}-${ver}${_suffix}.qcow2 ${size} >/dev/null 2>&1
echo "DONE".
echo ""
echo "Launching installation..."
if [ ! -z "${mirror_location}" ]; then
mirror_location="--location=${mirror_location}"
else
unset extra_opts
fi
if [ "${arch}" == "i686" ]; then
mirror_location="$(echo ${mirror_location} | sed -e 's/x86_64/i386/g')"
fi
if [ ! -z "${extra_opts}" ]; then
sudo virt-install \
--name="kolab-${dist}-${ver}${_suffix}" \
--ram=${mem} \
--vcpus=2 \
--disk="path=${TMPDIR:-/tmp}/kolab-${dist}-${ver}${_suffix}.qcow2" \
$minimal_disk \
$netinstall_disk \
$dvd1_disk \
$dvd2_disk \
--force \
${mirror_location} \
--extra-args="${extra_opts}" \
$network \
--hvm \
--virt-type=kvm
else
sudo virt-install \
--name="kolab-${dist}-${ver}${_suffix}" \
--ram=${mem} \
--vcpus=2 \
--disk="path=${TMPDIR:-/tmp}/kolab-${dist}-${ver}${_suffix}.qcow2" \
$minimal_disk \
$netinstall_disk \
$dvd1_disk \
$dvd2_disk \
--force \
${mirror_location} \
--network='bridge=br0' \
--hvm \
--virt-type=kvm
fi

File Metadata

Mime Type
text/x-diff
Expires
Sat, Apr 4, 9:25 AM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18823455
Default Alt Text
(16 KB)

Event Timeline