socsvn commit: r272577 - in soc2014/kczekirda/pxe-fai-head: head/usr.sbin/bsdinstall/scripts others

kczekirda at FreeBSD.org kczekirda at FreeBSD.org
Sun Aug 17 21:36:39 UTC 2014


Author: kczekirda
Date: Sun Aug 17 21:36:37 2014
New Revision: 272577
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=272577

Log:
  resolver tofile

Modified:
  soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/auto
  soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/netconfig
  soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/script
  soc2014/kczekirda/pxe-fai-head/others/template.input

Modified: soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/auto
==============================================================================
--- soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/auto	Sun Aug 17 21:36:31 2014	(r272576)
+++ soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/auto	Sun Aug 17 21:36:37 2014	(r272577)
@@ -177,7 +177,9 @@
     ;;
 "ZFS")	# ZFS
 	bsdinstall zfsboot || error
-	bsdinstall mount || error
+    if [ -z "$TOFILE" ]; then
+        bsdinstall mount || error
+    fi
 	;;
 *)
 	error
@@ -219,9 +221,11 @@
 bsdinstall time
 bsdinstall services
 
-dialog --backtitle "FreeBSD Installer" --title "Add User Accounts" --yesno \
-    "Would you like to add users to the installed system now?" 0 0 && \
-    bsdinstall adduser
+if [ -z "$TOFILE" ]; then
+    dialog --backtitle "FreeBSD Installer" --title "Add User Accounts" --yesno \
+        "Would you like to add users to the installed system now?" 0 0 && \
+        bsdinstall adduser
+fi
 
 finalconfig() {
 	exec 3>&1
@@ -271,7 +275,7 @@
 }
 
 # Allow user to change his mind
-finalconfig
+[ -z "$TOFILE" ] && finalconfig
 
 trap error SIGINT	# SIGINT is bad again
 if [ -z "$TOFILE" ]; then

Modified: soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/netconfig
==============================================================================
--- soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/netconfig	Sun Aug 17 21:36:31 2014	(r272576)
+++ soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/netconfig	Sun Aug 17 21:36:37 2014	(r272577)
@@ -126,6 +126,8 @@
 	fi
 fi
 
+[ "$TOFILE" ] && cp /etc/resolv.conf $BSDINSTALL_TMPETC
+
 SEARCH=""
 IP4_1=""
 IP4_2=""
@@ -217,32 +219,31 @@
     }' > ${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;
-}
-{
->---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"
+    BEGIN {
+        search=-1;
+        dns=1;
+    }
+    {
+        if (/^[[:space:]]+$/) {
+            next;
+        }
+        if (/^Nameserver$/) {
+            printf "\"\n";
+            search=0;
+            next;
+        }
+        if (search == -1) {
+            printf "DOMAIN=\"";
+            search=1;
+        }
+        if (search > 0) {
+            printf "%s%s", (search > 1) ? " " : "", $1;
+            search++;
+            next;
+        }
+        printf "DNS%s=\"%s\"\n", dns, $1;
+        dns++;
+    }' >> "$TOFILE"
 fi

Modified: soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/script
==============================================================================
--- soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/script	Sun Aug 17 21:36:31 2014	(r272576)
+++ soc2014/kczekirda/pxe-fai-head/head/usr.sbin/bsdinstall/scripts/script	Sun Aug 17 21:36:37 2014	(r272577)
@@ -61,8 +61,8 @@
 # NETMASK
 # GWV4
 # DOMAIN
-# DNS1V4
-# DNS2V4
+# DNS1
+# DNS2
 
 # TODO: network, users,
 # VARIABLES:
@@ -74,8 +74,8 @@
 # PREFIXV6
 : ${PREFIXV6:=64}
 # GWV6
-# DNS1V6
-# DNS2V6
+# DNS3
+# DNS4
 
 # ROOTPWHASH
 # USERSCONFIG
@@ -212,11 +212,7 @@
 
         if [ "$DHCP" = "NO" ]; then
                 echo "ifconfig_${INTERFACE}=\"inet $ADDRESSV4 netmask $NETMASK\"" >> $BSDINSTALL_TMPETC/rc.conf.network
-                echo "defaultrouter=\"$GWV4\"" >> $BSDINSTALL_TMPETC/rc.conf.network
-		mkdir $BSDINSTALL_CHROOT/etc/
-                echo "domain $DOMAIN" >> $BSDINSTALL_CHROOT/etc/resolv.conf
-                echo "nameserver $DNS1V4" >> $BSDINSTALL_CHROOT/etc/resolv.conf
-                echo "nameserver $DNS2V4" >> $BSDINSTALL_CHROOT/etc/resolv.conf
+                echo "defaultrouter=\"$GWV4\"" >> $BSDINSTALL_TMPETC/rc.conf.networ
         fi
 fi
 
@@ -229,15 +225,33 @@
 	if [ "$SLAAC" = "NO" ]; then
                 echo "ifconfig_${INTERFACE}_ipv6=\"ineti6 $ADDRESSV6 prefixlen $PREFIXV6\"" >> $BSDINSTALL_TMPETC/rc.conf.network
                 echo "ipv6_defaultrouter=\"$GWV6\"" >> $BSDINSTALL_TMPETC/rc.conf.network
-                if [ ! -d $BSDINSTALL_CHROOT/etc/ ]; then
-			mkdir $BSDINSTALL_CHROOT/etc/
-		fi
-                echo "domain $DOMAIN" >> $BSDINSTALL_CHROOT/etc/resolv.conf
-                echo "nameserver $DNS1V6" >> $BSDINSTALL_CHROOT/etc/resolv.conf
-                echo "nameserver $DNS2V6" >> $BSDINSTALL_CHROOT/etc/resolv.conf
-        fi
+    fi
+fi
+
+# resolver
+
+mkdir $BSDINSTALL_CHROOT/etc/
+if [ "$DOMAIN" ]; then
+    echo "domain $DOMAIN" >> $BSDINSTALL_CHROOT/etc/resolv.conf
+fi
+
+if [ "$DNS1" ]; then
+    echo "nameserver $DNS1" >> $BSDINSTALL_CHROOT/etc/resolv.conf
 fi
 
+if [ "$DNS2" ]; then
+    echo "nameserver $DNS2" >> $BSDINSTALL_CHROOT/etc/resolv.conf
+fi
+
+if [ "$DNS3" ]; then
+    echo "nameserver $DNS3" >> $BSDINSTALL_CHROOT/etc/resolv.conf
+fi
+
+if [ "$DNS4" ]; then
+    echo "nameserver $DNS4" >> $BSDINSTALL_CHROOT/etc/resolv.conf
+fi
+
+
 # Fetch distributions
 
 BSDINSTALL_FETCHDEST="$BSDINSTALL_CHROOT/usr/freebsd-dist"

Modified: soc2014/kczekirda/pxe-fai-head/others/template.input
==============================================================================
--- soc2014/kczekirda/pxe-fai-head/others/template.input	Sun Aug 17 21:36:31 2014	(r272576)
+++ soc2014/kczekirda/pxe-fai-head/others/template.input	Sun Aug 17 21:36:37 2014	(r272577)
@@ -16,22 +16,24 @@
 #GWV4="192.168.1.1"
 #IPV6="NO"
 #SLAAC="YES"
+#PARTITIONS="ada1 { auto freebsd-ufs /}"
+#DOMAIN="example.com"
+#DNS1="194.204.159.1"
+#DNS2="8.8.8.8"
+#DNS3="2001:4860:4860::8888"
+#DNS4="2001:4860:4860::8844"
+
+####################### Needed manual configuration
 
 #ADDRESSV6="2001:db8:4672:6565:2026:5043:2d42:5344"
 #PREFIXV6="64"
 #GWV6="2001:db8:4672:6565::1"
-
-#DOMAIN="example.com"
-#DNS1V4="194.204.159.1"
-#DNS2V4="8.8.8.8"
-#DNS1V6="2001:4860:4860::8888"
-#DNS2V6="2001:4860:4860::8844"
-
-#PARTITIONS="ada1 { auto freebsd-ufs /}"
 ROOTPWHASH='$6$Qb2inVrU65.r4Dx5$DaHdU2P1ipFMLZ8J5xJk8DDtC88rE87qo7du6CBvNgyit8RezQ2qkPe83X4KgTCTEtXGrMaMKZ1.W4xg1yz0z/'
 #ROOTPWPLAIN="password"
 #USERS="/etc/usersconfig"
 
+####################### end manual configuration
+
 ZFSBOOT="YES"
 
 ######################## ZFSPRESEED START


More information about the svn-soc-all mailing list