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.
This commit is contained in:
Kalev Lember 2015-10-20 20:23:23 +02:00
parent d293e561f4
commit a6d3b1c456

View File

@ -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