[Fai-commit] r3701 - trunk/bin

fai-commit at lists.alioth.debian.org fai-commit at lists.alioth.debian.org
Mon Jul 31 13:54:27 UTC 2006


Author: lange
Date: 2006-07-31 13:54:27 +0000 (Mon, 31 Jul 2006)
New Revision: 3701

Modified:
   trunk/bin/make-fai-nfsroot
Log:
new subroutine all_host_entries, which adds all IP addresses and
hostnames of the server to $NFSROOT/etc/hosts


Modified: trunk/bin/make-fai-nfsroot
===================================================================
--- trunk/bin/make-fai-nfsroot	2006-07-31 09:19:53 UTC (rev 3700)
+++ trunk/bin/make-fai-nfsroot	2006-07-31 13:54:27 UTC (rev 3701)
@@ -209,6 +209,14 @@
     yes '' | LC_ALL=C call_verbose debootstrap $FAI_DEBOOTSTRAP_OPTS $1 $NFSROOT $2
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+add_all_host_entries() {
+
+    local ips=$(ifconfig | grep -w inet | cut -d : -f 2 | cut -d ' ' -f 1 | grep -v 127.0.0.1)
+    for eth in $ips; do
+	getent hosts $eth >> etc/hosts
+    done
+}
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 create_base() {
 
     if [ "$FAI_DEBOOTSTRAP" ]; then
@@ -253,8 +261,8 @@
 
     egrep -q "127.0.0.1" etc/hosts 2>/dev/null || echo "127.0.0.1 localhost" >> etc/hosts
     egrep -q "$NFSROOT_ETC_HOSTS" etc/hosts 2>/dev/null || echo "$NFSROOT_ETC_HOSTS" >> etc/hosts
+    add_all_host_entries
 
-    getent hosts `hostname` >> etc/hosts
     # we need these option before installing the first package. So we
     # can't put this into fai-nfsroot /etc/apt/apt.conf.d/90fai
     cat <<EOF >$NFSROOT/etc/apt/apt.conf.d/10fai




More information about the Fai-commit mailing list