From 0bc399cf587cb8c220cd8e5f4d9f784844e77792 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Tue, 20 Oct 2015 20:23:23 +0200 Subject: [PATCH] packagekit-cached-metadata.ks: Set up resolv.conf and hosts files Copy over host system's /etc/resolv.conf and /etc/hosts to make it possible to resolve kojipkgs.fedoraproject.org inside the chroot. --- snippets/packagekit-cached-metadata.ks | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/snippets/packagekit-cached-metadata.ks b/snippets/packagekit-cached-metadata.ks index 163f2cb..af206b0 100644 --- a/snippets/packagekit-cached-metadata.ks +++ b/snippets/packagekit-cached-metadata.ks @@ -1,7 +1,20 @@ # %post script to include initial metadata for PackageKit +%post --nochroot +# Copy over files needed for networking inside the chroot +for f in /etc/resolv.conf /etc/hosts ; do + test -f $f && cp -a $f ${INSTALL_ROOT}${f}.kickstart +done +%end + %post +# Use host machine's resolv.conf and hosts files +for f in /etc/resolv.conf /etc/hosts ; do + test -f $f && mv $f $f.orig + test -f $f.kickstart && mv -f $f.kickstart $f +done + PK_PREFIX=`mktemp -d` mkdir -p $PK_PREFIX/etc/yum.repos.d if [ -f /etc/yum.repos.d/fedora.repo ] ; then @@ -31,4 +44,10 @@ if [ -d /var/cache/PackageKit ] ; then fi rm -rf $PK_PREFIX +# Restore original resolv.conf and hosts files +for f in /etc/resolv.conf /etc/hosts ; do + rm -f $f + test -f $f.orig && mv $f.orig $f +done + %end