diff --git a/packages/devel/glibc/config/nsswitch-init.conf b/packages/devel/glibc/config/nsswitch-init.conf new file mode 100644 index 0000000000..eba159e8fc --- /dev/null +++ b/packages/devel/glibc/config/nsswitch-init.conf @@ -0,0 +1,3 @@ +# This is just enough to get DNS resolution working in the initramfs + +hosts: dns diff --git a/packages/devel/glibc/config/nsswitch.conf b/packages/devel/glibc/config/nsswitch-target.conf similarity index 100% rename from packages/devel/glibc/config/nsswitch.conf rename to packages/devel/glibc/config/nsswitch-target.conf diff --git a/packages/devel/glibc/package.mk b/packages/devel/glibc/package.mk index 31fb59aeda..a9d589f94e 100644 --- a/packages/devel/glibc/package.mk +++ b/packages/devel/glibc/package.mk @@ -151,7 +151,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 @@ -176,8 +176,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 +} diff --git a/packages/sysutils/busybox/scripts/init b/packages/sysutils/busybox/scripts/init index 20f8651fd7..b1bf4a93d6 100755 --- a/packages/sysutils/busybox/scripts/init +++ b/packages/sysutils/busybox/scripts/init @@ -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