lorax/test/vm.install
Alexander Todorov dcb4c1a0e5 Backport Cockpit CI changes for RHEL 8
Notes:

- also install podman-docker
- on RHEL 8 there's no docker.service to start

Related: rhbz#1724073
2019-09-11 14:16:27 +03:00

47 lines
1.4 KiB
Bash
Executable File

#!/bin/sh -eux
SRPM="$1"
if ! rpm -q beakerlib; then
if [ $(. /etc/os-release && echo $ID) = "rhel" ]; then
(cd /etc/yum.repos.d; curl -O -L http://download.devel.redhat.com/beakerrepos/beaker-client-RedHatEnterpriseLinux.repo)
# The beaker repository doesn't include repos for minor releases
VERSION=$(. /etc/os-release && echo ${VERSION_ID%.*})
yum install -y --releasever=$VERSION --setopt=sslverify=0 beakerlib
# prevent yum from trying to sync the cache again later (it fails without sslverify=0)
rm /etc/yum.repos.d/beaker-client-RedHatEnterpriseLinux.repo
else
yum install -y beakerlib
fi
fi
if ! rpm -q podman-docker; then
yum install -y podman-docker
fi
if ! rpm -q git; then
yum install -y git
fi
if ! rpm -q qemu-kvm; then
yum install -y qemu-kvm
fi
# Grow root partition to make room for images. This only works on Fedora right now.
parted --script /dev/vda resizepart 2 100%
partprobe
pvs --noheadings -opv_name | xargs pvresize
rootlv=$(findmnt --noheadings -oSOURCE /)
lvresize $rootlv -l+100%FREE -r
rm -rf build-results
su builder -c "/usr/bin/mock --no-clean --resultdir build-results --rebuild $SRPM"
packages=$(find build-results -name '*.rpm' -not -name '*.src.rpm')
rpm -e --verbose $(basename -a ${packages[@]} | sed 's/-[0-9].*.rpm$//') || true
yum install -y $packages
systemctl enable lorax-composer.socket