From 25036e427f231bc12aca4aeb19d10226b9290e6d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 23 Jul 2010 16:20:32 +0200 Subject: [PATCH] Adding support for resolving DNS names from initramfs, thanks to Michal Suchanek for initial patch which this is based on (Closes: #589659). --- hooks/live | 25 +++++++++++++++++++++++++ scripts/live | 16 ++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/hooks/live b/hooks/live index d87bfe7..34d6eab 100755 --- a/hooks/live +++ b/hooks/live @@ -24,6 +24,20 @@ esac # live-boot hook +# Reading configuration file from filesystem +if [ -e /etc/live/boot.conf ] +then + . /etc/live/boot.conf +fi + +if ls /etc/live/boot.conf.d/* > /dev/null 2>&1 +then + for _FILE in /etc/live/boot.conf.d/* + do + . ${_FILE} + done +fi + # Handling live-boot # Configuration @@ -226,3 +240,14 @@ then manual_add_modules iscsi_tcp manual_add_modules crc32c fi + +if [ "${LIVE_DNS}" = "true" ] +then + #copy_exec /lib/libnss_files.so.* /lib # /etc/hosts and /etc/passwd + copy_exec /lib/libnss_dns.so.* /lib # DNS server + #copy_exec /lib/libnss_compat.so.* /lib # /etc/passwd + + # Configuration file - may be needed if /etc/hosts is used. + #mkdir -p $DESTDIR/etc + #cp -p /etc/nsswitch.conf $DESTDIR/etc +fi diff --git a/scripts/live b/scripts/live index f5f4ad2..295b75f 100755 --- a/scripts/live +++ b/scripts/live @@ -639,6 +639,22 @@ do_netsetup () HWADDR="$(cat /sys/class/net/${DEVICE}/address)" fi + if [ ! -e "/etc/resolv.conf" ] + then + echo "Creating /etc/resolv.conf" + + if [ -n "${DNSDOMAIN}" ] + then + echo "domain ${DNSDOMAIN}" > /etc/resolv.conf + echo "search ${DNSDOMAIN}" > /etc/resolv.conf + fi + + for i in ${IPV4DNS0} ${IPV4DNS1} ${IPV4DNS1} + do + echo "nameserver $i" >> /etc/resolv.conf + done + fi + # Check if we have a network device at all if ! ls /sys/class/net/"$DEVICE" > /dev/null 2>&1 && \ ! ls /sys/class/net/eth0 > /dev/null 2>&1 && \ -- 2.1.4