Merge pull request #1764 from chrisnovakovic/initramfs-enable-dns

initramfs: enable DNS if network is up
This commit is contained in:
MilhouseVH 2017-07-12 04:39:36 +01:00 committed by GitHub
commit c023719429
4 changed files with 16 additions and 1 deletions

View File

@ -0,0 +1,3 @@
# This is just enough to get DNS resolution working in the initramfs
hosts: dns

View File

@ -159,7 +159,7 @@ post_makeinstall_target() {
# create default configs
mkdir -p $INSTALL/etc
cp $PKG_DIR/config/nsswitch.conf $INSTALL/etc
cp $PKG_DIR/config/nsswitch-target.conf $INSTALL/etc/nsswitch.conf
cp $PKG_DIR/config/host.conf $INSTALL/etc
cp $PKG_DIR/config/gai.conf $INSTALL/etc
@ -184,8 +184,16 @@ makeinstall_init() {
cp -PR $PKG_BUILD/.$TARGET_NAME/math/libm.so* $INSTALL/usr/lib
cp -PR $PKG_BUILD/.$TARGET_NAME/nptl/libpthread.so* $INSTALL/usr/lib
cp -PR $PKG_BUILD/.$TARGET_NAME/rt/librt.so* $INSTALL/usr/lib
cp -PR $PKG_BUILD/.$TARGET_NAME/resolv/libnss_dns.so* $INSTALL/usr/lib
cp -PR $PKG_BUILD/.$TARGET_NAME/resolv/libresolv.so* $INSTALL/usr/lib
if [ "$TARGET_ARCH" = "arm" -a "$TARGET_FLOAT" = "hard" ]; then
ln -sf ld.so $INSTALL/usr/lib/ld-linux.so.3
fi
}
post_makeinstall_init() {
# create default configs
mkdir -p $INSTALL/etc
cp $PKG_DIR/config/nsswitch-init.conf $INSTALL/etc/nsswitch.conf
}

View File

@ -1003,6 +1003,10 @@
[ -f "/sysroot/usr/lib/systemd/systemd" ] || error "final_check" "Could not find systemd!"
}
# If the network is up (due to the use of the "ip" kernel parameter) and a DNS
# server is known, allow the libc resolver to use it
grep '^\(nameserver\|domain\) ' /proc/net/pnp | grep -v '^nameserver 0\.0\.0\.0$' > /etc/resolv.conf
if [ "${boot%%=*}" = "FILE" ]; then
error "check arguments" "boot argument can't be FILE type..."
fi