commit 0bc399cf587cb8c220cd8e5f4d9f784844e77792
Author: Kalev Lember <klember(a)redhat.com>
Date: Tue Oct 20 20:23:23 2015 +0200
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 files changed, 19 insertions(+), 0 deletions(-)
---
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