yum-minimal: pre-install base packages

We were getting some subtle issues in fedora-minimal builds that
turned out to be because /var/run was not a symlink to /run.

Upon further investigation, it turns out that yum is creating a
/var/run directory for it's pid file when it starts working in the
empty chroot (which I verified by stracing it)

---
5905  stat("/home/ubuntu/tmp/dib-tmp/image.Ac4VZZsl/mnt/var/run", 0x7ffddffa0330) = -1 ENOENT (No such file or directory)
5905  mkdir("/home/ubuntu/tmp/dib-tmp/image.Ac4VZZsl/mnt/var/run", 0755) = 0
5905  open("/home/ubuntu/tmp/dib-tmp/image.Ac4VZZsl/mnt/var/run/yum.pid", O_WRONLY|O_CREAT|O_EXCL, 0644) = 6
---

Because this happens *before* we install "filesystem" (the package),
we mess up it's symlinking.

To work-around this, pre-install the trio of base packages (setup,
basesystem, filesystem) with rpm from outside the chroot.

Change-Id: I411b6ec9d91d95d3a0f98e76853086af3b70abe8
This commit is contained in:
Ian Wienand 2016-02-11 15:42:10 +11:00
parent 11bc493808
commit 349e8db2f7

View File

@ -52,21 +52,35 @@ _RPM="rpm --dbpath=/var/lib/rpm"
# note this runs outside the chroot, where we're assuming the platform # note this runs outside the chroot, where we're assuming the platform
# has yum/yumdownloader # has yum/yumdownloader
function _install_repos { function _install_repos {
local packages
# pre-install the base system packages via rpm. We previously
# just left it up to yum to drag these in when we "yum install
# yum" in the chroot in _install_pkg_manager. This raised a small
# problem that inside the empty chroot yum went ahead and did a
# mkdir for /var/run to put some pid file in, which then messed up
# the "filesystem" package making /var/run a symlink to /run
# ... which leads to odd issues with a running system.
#
# TODO: these packages still have some small %posttrans stuff that
# depends on other packages (see rhbz#1306489) ... maybe the idea
# is that they are only installed in one big transaction with the
# rest of the system? but we don't want to use yum to do this
# (see above) so ...
packages="basesystem filesystem setup "
packages+="${DISTRO_NAME}-release "
# after fedora21, this is split into into a separate -repos
# package
if [ $DISTRO_NAME = fedora ]; then
packages+="${DISTRO_NAME}-repos "
fi
yumdownloader \ yumdownloader \
--releasever=$DIB_RELEASE \ --releasever=$DIB_RELEASE \
--setopt=reposdir=$TMP_HOOKS_PATH/yum.repos.d \ --setopt=reposdir=$TMP_HOOKS_PATH/yum.repos.d \
--destdir=$WORKING \ --destdir=$WORKING \
${DISTRO_NAME}-release ${packages}
# after fedora21, this is split into into a separate -repos
# package
if [ $DISTRO_NAME = fedora ] ; then
yumdownloader \
--releasever=$DIB_RELEASE \
--setopt=reposdir=$TMP_HOOKS_PATH/yum.repos.d \
--destdir=$WORKING \
${DISTRO_NAME}-repos
fi
# --nodeps works around these wanting /bin/sh in some fedora # --nodeps works around these wanting /bin/sh in some fedora
# releases, see rhbz#1265873 # releases, see rhbz#1265873