[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#589659: live-boot: support dns names in netboot



Package: live-boot
Version: 2.0~a12+20100707.181407
Severity: normal


Currently live-boot can netbbot only form servers specified by IP
address, not by DNS name.

For filesystems mountd by binaries linked with glinc including the NSS
modules and a resolv.conf should suffice to make this work.

For filesystems mountd by binaries from busybox or klibc-utils the
situation may be different. I think the simplistic mount command is used
for mounting nfs and cifs and glibc binaries are used for iscsi, httpfs
and ftpfs. wget exists both as a simplistic binary and as full binary
and currently the simplistic binary is used for fetch I think.

Attaching an initramfs hook which pulls NSS modules and a live script
patch which creates /etc/resolv.conf in the initramfs.


-- System Information:
Debian Release: squeeze/sid
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
--- usr/share/initramfs-tools/scripts/live	2010-07-19 19:04:13.000000000 +0200
+++ usr/share/initramfs-tools/scripts/live	2010-07-19 19:05:37.000000000 +0200
@@ -639,6 +639,17 @@
 		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 && \
#!/bin/sh -e

PREREQS=""

prereqs() { echo "$PREREQS"; }

case "$1" in
    prereqs)
    prereqs
    exit 0
    ;;
esac

.. /usr/share/initramfs-tools/hook-functions

copy_exec /lib/libnss_files.so.*      /lib
copy_exec /lib/libnss_dns.so.*      /lib
copy_exec /lib/libnss_compat.so.*      /lib

mkdir -p $DESTDIR/etc
cp -p /etc/nsswitch.conf $DESTDIR/etc


Reply to: