2019-06-25 09:50:37 +00:00
|
|
|
#!/bin/sh -eux
|
|
|
|
|
2019-11-27 11:43:14 +00:00
|
|
|
BACKEND="${BACKEND:-lorax-composer}"
|
2019-06-25 09:50:37 +00:00
|
|
|
SRPM="$1"
|
|
|
|
|
2019-11-21 09:10:57 +00:00
|
|
|
# always remove older versions of these RPMs if they exist
|
|
|
|
# to ensure newly built packages have been installed
|
2019-11-27 11:43:14 +00:00
|
|
|
yum -y remove lorax $BACKEND composer-cli
|
2019-11-21 09:10:57 +00:00
|
|
|
|
2019-06-25 09:50:37 +00:00
|
|
|
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)
|
2019-11-06 13:12:13 +00:00
|
|
|
# disable sslverify b/c yum will fail to sync metadata otherwise
|
|
|
|
sed -i "s/\(gpgcheck=0\)/\1\nsslverify=0/" /etc/yum.repos.d/beaker-client-RedHatEnterpriseLinux.repo
|
|
|
|
# do not remove the repo file. We now have tests which use beakerlib
|
|
|
|
# inside their blueprints so this needs to stay on the VM
|
2019-06-25 09:50:37 +00:00
|
|
|
fi
|
2019-11-06 13:12:13 +00:00
|
|
|
|
|
|
|
yum install -y beakerlib
|
2019-06-25 09:50:37 +00:00
|
|
|
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')
|
2019-11-27 11:43:14 +00:00
|
|
|
if [ "$BACKEND" == "osbuild-composer" ]; then
|
|
|
|
packages=$(find build-results -name '*.rpm' -not -name '*.src.rpm' -not -name '*lorax-composer*')
|
|
|
|
fi
|
|
|
|
yum install -y $packages $BACKEND
|
2019-06-25 09:50:37 +00:00
|
|
|
|
2019-11-27 11:43:14 +00:00
|
|
|
systemctl enable $BACKEND.socket
|
2019-10-23 23:44:15 +00:00
|
|
|
|
|
|
|
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
|