diff --git a/vms/autoinstall/twentythree-160-candlepin.cfg b/vms/autoinstall/twentythree-160-candlepin.cfg new file mode 100644 index 0000000..3e14518 --- /dev/null +++ b/vms/autoinstall/twentythree-160-candlepin.cfg @@ -0,0 +1,40 @@ +lang en_US.UTF-8 +keyboard us +timezone --utc Europe/Zurich +auth --useshadow --enablemd5 +selinux --permissive +firewall --disabled +firstboot --disabled +zerombr +clearpart --all --initlabel +autopart +rootpw --plaintext Welcome2KolabSystems +bootloader --location=mbr +services --enabled=NetworkManager --disabled=network + +network --hostname=kolab.example.org + +reboot + +repo --name=candlepin --baseurl=http://obs.kolabsys.com/repositories/home:/vanmeeuwen:/candlepin/CentOS_7/ + +%packages --default +candlepin-tomcat +postgresql +postgresql-server +%end + +%post +pushd /etc/systemd/system/ +rm -rf default.target +ln -s /lib/systemd/system/runlevel3.target default.target +popd + +# Insert SSH key +mkdir -p /root/.ssh/ +cat >/root/.ssh/authorized_keys < [options]" echo "" echo "Options:" echo "" echo " [--size \$xG]" echo " [--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 ;; 160) ver="160" shift ;; ## ## Red Hat Enterprise Linux / CentOS ## tikanga) [ -z "${ver}" ] && usage dist="tikanga" 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.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.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://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://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://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 ;; heisenbug) [ -z "${ver}" ] && usage 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 ;; + twentythree) + [ -z "${ver}" ] && usage + dist="twentythree" + mirror_location="http://mirror.switch.ch/ftp/mirror/fedora/linux/releases/23/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://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|heisenbug|santiago|maipo) + beefymiracle|sphericalcow|schroederingerscat|heisenbug|twentythree|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 if [ ! -f "${TMPDIR:-/tmp}/stick.git/vms/autoinstall/${dist}-${ver}-${suffix}.cfg" ]; then extra_opts=$(echo ${extra_opts} | sed -e "s/\-${suffix}.cfg/\-empty.cfg/g") fi elif [ "${ver}" == "140" ]; then if [ ! -f "${TMPDIR:-/tmp}/stick.git/vms/autoinstall/${dist}-${ver}-${suffix}.cfg" ]; then extra_opts=$(echo ${extra_opts} | sed -e "s/\-${suffix}.cfg/\-empty.cfg/g") fi elif [ "${ver}" == "160" ]; then if [ ! -f "${TMPDIR:-/tmp}/stick.git/vms/autoinstall/${dist}-${ver}-${suffix}.cfg" ]; then extra_opts=$(echo ${extra_opts} | sed -e "s/\-${suffix}.cfg/\-empty.cfg/g") fi fi sed -i -e '/^kolab.example.org/d' -e '/^192.168.122./d' ~/.ssh/known_hosts if [ "${dist}" == "tikanga" ]; then if [ -f /var/lib/libvirt/images/CentOS-5.8-x86_64-minimal.iso ]; then minimal_disk="--disk=path=/var/lib/libvirt/images/CentOS-5.8-x86_64-minimal.iso,device=cdrom" fi if [ -f /var/lib/libvirt/images/CentOS-5.8-x86_64-netinstall.iso ]; then netinstall_disk="--disk=path=/var/lib/libvirt/images/CentOS-5.8-x86_64-netinstall.iso,device=cdrom" fi if [ -f /var/lib/libvirt/images/CentOS-5.8-x86_64-bin-DVD-1of2.iso ]; then minimal_disk="" netinstall_disk="" dvd1_disk="--disk=path=/var/lib/libvirt/images/CentOS-5.8-x86_64-bin-DVD-1of2.iso,device=cdrom" [ -f /var/lib/libvirt/images/CentOS-5.8-x86_64-bin-DVD-2of2.iso ] && \ dvd2_disk="--disk=path=/var/lib/libvirt/images/CentOS-5.8-x86_64-bin-DVD-2of2.iso,device=cdrom" fi elif [ "${dist}" == "santiago" ]; then if [ -f /var/lib/libvirt/images/CentOS-6.4-x86_64-minimal.iso ]; then minimal_disk="--disk=path=/var/lib/libvirt/images/CentOS-6.4-x86_64-minimal.iso,device=cdrom" fi if [ -f /var/lib/libvirt/images/CentOS-6.4-x86_64-netinstall.iso ]; then netinstall_disk="--disk=path=/var/lib/libvirt/images/CentOS-6.4-x86_64-netinstall.iso,device=cdrom" fi if [ -f /var/lib/libvirt/images/CentOS-6.4-x86_64-bin-DVD1.iso ]; then minimal_disk="" netinstall_disk="" dvd1_disk="--disk=path=/var/lib/libvirt/images/CentOS-6.4-x86_64-bin-DVD1.iso,device=cdrom" [ -f /var/lib/libvirt/images/CentOS-6.4-x86_64-bin-DVD2.iso ] && \ dvd2_disk="--disk=path=/var/lib/libvirt/images/CentOS-6.4-x86_64-bin-DVD2.iso,device=cdrom" fi elif [ "${dist}" == "maipo" ]; then if [ -f /var/lib/libvirt/images/CentOS-7.0-1406-x86_64-DVD.iso ]; then minimal_disk="" netinstall_disk="" dvd1_disk="--disk=path=/var/lib/libvirt/images/CentOS-7.0-1406-x86_64-DVD.iso,device=cdrom" fi #elif [ "${dist}" == "wheezy" ]; then # if [ -f /var/lib/libvirt/images/debian-wheezy-DI-b3-amd64-netinst.iso ]; then # netinstall_disk="--disk=path=/var/lib/libvirt/images/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 /var/lib/libvirt/images/kolab-${dist}-${ver}${_suffix}.qcow2 >/dev/null 2>&1 echo "DONE." echo -n "Creating virtual machine disk image... " sudo qemu-img create -f qcow2 /var/lib/libvirt/images/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=/var/lib/libvirt/images/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=/var/lib/libvirt/images/kolab-${dist}-${ver}${_suffix}.qcow2" \ $minimal_disk \ $netinstall_disk \ $dvd1_disk \ $dvd2_disk \ --force \ ${mirror_location} \ --network='bridge=br0' \ --hvm \ --virt-type=kvm fi