Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Aug 2014 19:59:20 GMT
From:      kczekirda@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r272231 - soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts
Message-ID:  <201408111959.s7BJxK8W008673@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kczekirda
Date: Mon Aug 11 19:59:19 2014
New Revision: 272231
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=272231

Log:
  network tofile with problems

Modified:
  soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/netconfig
  soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/netconfig_ipv4
  soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/netconfig_ipv6

Modified: soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/netconfig
==============================================================================
--- soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/netconfig	Mon Aug 11 19:59:13 2014	(r272230)
+++ soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/netconfig	Mon Aug 11 19:59:19 2014	(r272231)
@@ -107,6 +107,7 @@
 		exec $0
 	else
 		IPV4_AVAIL=0
+        [ ! -z "$TOFILE" ] && echo IPV4=\"NO\" >> "$TOFILE"
 	fi
 fi
 # In case wlanconfig left an option and we do not support IPv4 we need to write
@@ -121,6 +122,7 @@
 		bsdinstall netconfig_ipv6 ${INTERFACE} || exec $0
 	else
 		IPV6_AVAIL=0
+        [ ! -z "$TOFILE" ] && echo IPV6=\"NO\" >> "$TOFILE"
 	fi
 fi
 
@@ -187,30 +189,60 @@
 if [ $? -eq $DIALOG_CANCEL ]; then exec $0; fi
 exec 3>&-
 
-echo ${RESOLV} | tr ' ' '\n' | \
-awk '
+if [ -z "$TOFILE" ]; then
+    echo ${RESOLV} | tr ' ' '\n' | \
+    awk '
+    BEGIN {
+    	search=-1;
+    }
+    {
+    	if (/^[[:space:]]+$/) {
+    		next;
+    	}
+    	if (/^Nameserver$/) {
+    		printf "\n";
+    		search=0;
+    		next;
+    	}
+    	if (search == -1) {
+    		printf "search ";
+    		search=1;
+    	}
+    	if (search > 0) {
+    		printf "%s%s", (search > 1) ? " " : "", $1;
+    		search++;
+    		next;
+    	}
+    	printf "nameserver %s\n", $1;
+    }' > ${BSDINSTALL_TMPETC}/resolv.conf
+    mv $BSDINSTALL_TMPETC/._rc.conf.net $BSDINSTALL_TMPETC/rc.conf.net
+else
+    echo ${RESOLV} >> "$TOFILE"
+    echo resolv >> "$TOFILE"
+    echo ${RESOLV} | tr ' ' '\n' | \
+    awk '
 BEGIN {
-	search=-1;
+>---search=-1;
 }
 {
-	if (/^[[:space:]]+$/) {
-		next;
-	}
-	if (/^Nameserver$/) {
-		printf "\n";
-		search=0;
-		next;
-	}
-	if (search == -1) {
-		printf "search ";
-		search=1;
-	}
-	if (search > 0) {
-		printf "%s%s", (search > 1) ? " " : "", $1;
-		search++;
-		next;
-	}
-	printf "nameserver %s\n", $1;
-}' > ${BSDINSTALL_TMPETC}/resolv.conf
-
-mv $BSDINSTALL_TMPETC/._rc.conf.net $BSDINSTALL_TMPETC/rc.conf.net
+>---if (/^[[:space:]]+$/) {
+>--->---next;
+>---}
+>---if (/^Nameserver$/) {
+>--->---printf "\n";
+>--->---search=0;
+>--->---next;
+>---}
+>---if (search == -1) {
+>--->---printf "search ";
+>--->---search=1;
+>---}
+>---if (search > 0) {
+printf "DOMAIN=\"";
+>--->---printf "%s%s", (search > 1) ? " " : "", $1;
+>--->---search++;
+>--->---next;
+>---}
+>---printf "DNS=\"%s\n\"", $1;
+}' >> "$TOFILE"
+fi

Modified: soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/netconfig_ipv4
==============================================================================
--- soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/netconfig_ipv4	Mon Aug 11 19:59:13 2014	(r272230)
+++ soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/netconfig_ipv4	Mon Aug 11 19:59:19 2014	(r272231)
@@ -66,6 +66,8 @@
 	exit 0
 fi
 
+[ -z "$TOFILE" ] && echo DHCP=\"NO\" >> "$TOFILE"
+
 IP_ADDRESS=`ifconfig $INTERFACE inet | awk '/inet/ {printf("%s\n", $2); }'`
 NETMASK=`ifconfig $INTERFACE inet | awk '/inet/ {printf("%s\n", $4); }'`
 ROUTER=`netstat -rn -f inet | awk '/default/ {printf("%s\n", $2);}'`

Modified: soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/netconfig_ipv6
==============================================================================
--- soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/netconfig_ipv6	Mon Aug 11 19:59:13 2014	(r272230)
+++ soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/netconfig_ipv6	Mon Aug 11 19:59:19 2014	(r272231)
@@ -150,8 +150,34 @@
     	printf("ifconfig_%s_ipv6=\"inet6 %s\"\n", iface, $1);
     }' >> $BSDINSTALL_TMPETC/._rc.conf.net
 else
-    echo $IF_CONFIG
-    echo "static ip6" >> "$TOFILE"
+    echo ${IF_CONFIG} | tr ' ' '\n' | \
+    awk -v iface="${INTERFACE}" '
+    BEGIN {
+    >---dfr=0;
+    >---count=0;
+    }
+    {
+    >---if (/^[[:space:]]+$/) {
+    >--->---next;
+    >---}
+    >---if (/DefaultRouter/) {
+    >--->---dfr=1;
+    >--->---next;
+    >---}
+    >---if (dfr == 1) {
+    >--->---printf("ipv6_defaultrouter=\"%s\"\n", $1);
+    >--->---next;
+    >---}
+    >---if (count > 0) {
+    >--->---# Ignore all but the first IP address for now.
+    >--->---next;
+    >---}
+    >---count++;
+    >---if (!match($1, "/")) {
+    >--->---sub("$", "/64", $1);
+    >---}
+    >---printf("ifconfig_%s_ipv6=\"inet6 %s\"\n", iface, $1);
+    }' >> "$TOFILE"
 fi
 
 if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408111959.s7BJxK8W008673>