2019-04-12 18:17:28 +00:00
|
|
|
#!/bin/sh -eux
|
|
|
|
|
|
|
|
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
|
2021-04-23 18:57:15 +00:00
|
|
|
yum -y remove lorax
|
2019-11-21 09:10:57 +00:00
|
|
|
|
2019-05-22 14:42:03 +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)
|
|
|
|
|
|
|
|
# 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
|
2019-05-21 17:54:18 +00:00
|
|
|
fi
|
|
|
|
|
2019-10-28 09:14:57 +00:00
|
|
|
# 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
|
|
|
|
|
2020-04-27 10:05:09 +00:00
|
|
|
# HACK: Fedora ships baseurl with `example.com` as domain
|
|
|
|
# Example: `#baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Everything/$basearch/`
|
|
|
|
sed -i "s/download.example/dl.fedoraproject.org/" /etc/yum.repos.d/*.repo
|
|
|
|
|
2021-01-07 10:29:01 +00:00
|
|
|
# Grow root partition on LVM test images to make room for built images
|
|
|
|
PVS=$(pvs --noheadings -opv_name)
|
|
|
|
if [ -n "$PVS" ]; then
|
|
|
|
echo ", +" | sfdisk -N 2 -f /dev/vda
|
|
|
|
partprobe
|
|
|
|
echo "$PVS" | xargs pvresize
|
|
|
|
rootlv=$(findmnt --noheadings -oSOURCE /)
|
|
|
|
lvresize $rootlv -l+100%FREE -r
|
|
|
|
fi
|
2019-04-12 18:17:28 +00:00
|
|
|
|
2019-05-21 15:17:15 +00:00
|
|
|
rm -rf build-results
|
2019-10-11 22:19:42 +00:00
|
|
|
su builder -c "/usr/bin/mock --verbose --no-clean --resultdir build-results --rebuild $SRPM"
|
2019-04-12 18:17:28 +00:00
|
|
|
|
|
|
|
packages=$(find build-results -name '*.rpm' -not -name '*.src.rpm')
|
2021-04-23 18:57:15 +00:00
|
|
|
yum install -y $packages
|
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
|