lorax/test/vm.install
Alexander Todorov 70baff3bc2 Always remove lorax-composer & composer-cli RPMs before installing them
this will ensure locally built packages are always installed
2019-11-26 13:52:54 +02:00

51 lines
1.7 KiB
Bash

#!/bin/sh -eux
SRPM="$1"
# always remove older versions of these RPMs if they exist
# to ensure newly built packages have been installed
yum -y remove lorax lorax-composer composer-cli
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
# disable mirrors & re-enable direct download
sed -i "s/metalink.*//" /etc/yum.repos.d/*.repo
sed -i "s/#\(baseurl=.*\)/\1/" /etc/yum.repos.d/*.repo
sed -i "s/download.fedoraproject/dl.fedoraproject/" /etc/yum.repos.d/*.repo
# Grow root partition to make room for images. This only works on Fedora right now.
echo ", +" | sfdisk -N 2 -f /dev/vda
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 --verbose --no-clean --resultdir build-results --rebuild $SRPM"
packages=$(find build-results -name '*.rpm' -not -name '*.src.rpm')
yum install -y $packages
systemctl enable lorax-composer.socket
if [ -f /usr/bin/docker ]; then
yum remove -y $(rpm -qf /usr/bin/docker)
fi
if ! rpm -q podman-docker; then
yum install -y podman-docker
fi