2019-06-17 12:35:31 +00:00
|
|
|
#!/bin/sh -eux
|
|
|
|
|
|
|
|
SRPM="$1"
|
|
|
|
|
2019-07-05 14:56:14 +00:00
|
|
|
LATEST_REPO="/etc/yum.repos.d/rhel7-rel-eng-latest.repo"
|
|
|
|
if [ ! -f "$LATEST_REPO" ]; then
|
|
|
|
cat > $LATEST_REPO << __EOF__
|
|
|
|
[rhel7-rel-eng-latest]
|
|
|
|
gpgcheck=0
|
|
|
|
enabled=1
|
|
|
|
skip_if_unavailable=0
|
|
|
|
name=rhel7-rel-eng-latest
|
|
|
|
baseurl=http://download-node-02.eng.bos.redhat.com/rhel-7/rel-eng/latest-RHEL-7/compose/Server/\$basearch/os/
|
|
|
|
__EOF__
|
|
|
|
fi
|
|
|
|
|
2019-06-17 12:35:31 +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
|
|
|
|
fi
|
|
|
|
|
2019-08-01 11:34:57 +00:00
|
|
|
EPEL_REPO="/etc/yum.repos.d/epel7.repo"
|
|
|
|
if [ ! -f "$EPEL_REPO" ]; then
|
|
|
|
cat > $EPEL_REPO << __EOF__
|
|
|
|
[epel7]
|
|
|
|
name=epel7
|
|
|
|
failovermethod=priority
|
|
|
|
enabled=1
|
|
|
|
skip_if_unavailable=0
|
|
|
|
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=\$basearch
|
|
|
|
gpgcheck=0
|
|
|
|
__EOF__
|
|
|
|
fi
|
|
|
|
|
|
|
|
# EPEL packages used in tests
|
|
|
|
if ! rpm -q python2-pip; then
|
|
|
|
yum -y install python2-pip
|
|
|
|
fi
|
|
|
|
|
|
|
|
# don't build images with EPEL enabled
|
|
|
|
rm -f $EPEL_REPO
|
|
|
|
|
2019-07-05 16:00:55 +00:00
|
|
|
if rpm -q python2-cryptography; then
|
|
|
|
yum remove -y python2-cryptography
|
|
|
|
fi
|
|
|
|
|
|
|
|
if rpm -q pyparsing; then
|
|
|
|
yum remove -y pyparsing
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! rpm -q git; then
|
|
|
|
yum install -y git
|
|
|
|
fi
|
|
|
|
|
2019-06-17 12:35:31 +00:00
|
|
|
# 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
|
|
|
|
systemctl enable docker.service
|