r3848 - in jhalfs/branches/new_features: . LFS common/libs

pierre at higgs.linuxfromscratch.org pierre at higgs.linuxfromscratch.org
Sun Dec 13 07:28:33 PST 2015


Author: pierre
Date: Sun Dec 13 07:28:33 2015
New Revision: 3848

Log:
Add IP, hostname, domain, etc to the list of configuration parameters.
Font and encoding are in configuration too, but are not passed to the build
commands
Works only for LFS

Modified:
   jhalfs/branches/new_features/Config.in
   jhalfs/branches/new_features/LFS/lfs.xsl
   jhalfs/branches/new_features/common/libs/func_book_parser
   jhalfs/branches/new_features/common/libs/func_validate_configs.sh
   jhalfs/branches/new_features/jhalfs

Modified: jhalfs/branches/new_features/Config.in
==============================================================================
--- jhalfs/branches/new_features/Config.in	Sun Dec 13 05:50:54 2015	(r3847)
+++ jhalfs/branches/new_features/Config.in	Sun Dec 13 07:28:33 2015	(r3848)
@@ -750,8 +750,8 @@
 
 menu "--- Build Settings"
 
-	#--- Test Suites
-	config	CONFIG_TESTS
+    #--- Test Suites
+    config	CONFIG_TESTS
 		bool	"Run testsuites"
 		depends	!BOOK_CLFS2 && !BOOK_CLFS3
 		default	y
@@ -760,7 +760,7 @@
 			#
 			#  You will have to select between:
 			#
-			#  - Only final system Glibc, GCC and Binutils testsuites
+			#  - Only critical final system testsuites
 			#  - All final system testsuites
 			#  - Both temporary tools and final system testsuites
 			#
@@ -774,45 +774,54 @@
 			#  - Abort the build at the first test suite failure
 			#
 
+    menu "Test settings"
+	depends	CONFIG_TESTS
 	choice
 		prompt	"Tests level"
-		depends	 CONFIG_TESTS
 		default	TST_1
 
 		config  TST_1
-			bool	"Only final critical testsuites" if !BOOK_CLFS2 && !BOOK_CLFS3
+			bool	"Only final system critical testsuites"
+			help
+				#-- Critical tests:
+				# Only Glibc, Binutils, GMP, MPFR, MPC and GCC
+				# testsuites for final system
 
 		config	TST_2
 			bool	"All final system testsuites"
 
 		config	TST_3
-			bool	"Both temporary tools and final system testsuites" if !BOOK_HLFS && !BOOK_CLFS
+			bool	"All testsuites" if !BOOK_HLFS && !BOOK_CLFS
+			help
+				#-- All tests:
+				# Runs all the testsuites for both temporary tools
+				# and final system
 	endchoice
 
-	config	TEST
-		int
-		default	"0"	if !CONFIG_TESTS
-		default	"1"	if TST_1
-		default	"2"	if TST_2
-		default	"3"	if TST_3
-
 	choice
 		prompt	"Flavour"
-		depends	CONFIG_TESTS
 
 		config	NO_BOMB
-			bool	"Don't stop on testsuite failures"
+			bool	"Don't stop on test failures"
 
 		config	BOMB
-			bool	"Abort the build on the first testsuite failure"
+			bool	"Abort the build on the first test failure"
 	endchoice
 
+	config	TEST
+		int
+		default	"0"	if !CONFIG_TESTS
+		default	"1"	if TST_1
+		default	"2"	if TST_2
+		default	"3"	if TST_3
+
 	config	BOMB_TEST
 		bool
 		default	n if NO_BOMB
 		default	y if BOMB
 
 	#--- End Test Suites
+    endmenu # test settings
 
 	#--- Package Management
 	config  PKGMNGT
@@ -846,6 +855,23 @@
 
 	#--- End Installed files logs
 
+	config	STRIP
+		bool "Strip Installed Binaries/Libraries"
+		default y
+		depends on !BOOK_CLFS3
+
+	config	NO_PROGRESS_BAR
+		bool "DO NOT use/display progress_bar "
+		default n
+		help
+			#-- Do not use the progress bar routine. On slower machines
+			#   this function consumes precious CPU cycles.
+
+#--- End Build Settings
+endmenu
+
+menu "--- System configuration
+
 	#--- FSTAB
 	config	HAVE_FSTAB
 		bool	"Use a custom fstab file"
@@ -883,11 +909,6 @@
 			#   and renamed 'kernel-config'
 	#--- End Kernel
 
-	config	STRIP
-		bool "Strip Installed Binaries/Libraries"
-		default y
-		depends on !BOOK_CLFS3
-
 	config	VIMLANG
 		bool "Install vim-lang package"
 		default n
@@ -897,13 +918,6 @@
 			#   NOTE: This option is obsolete with the 7.3 release of Vim
 			#   which is included in all recent releases of LFS.
 
-	config	NO_PROGRESS_BAR
-		bool "DO NOT use/display progress_bar "
-		default n
-		help
-			#-- Do not use the progress bar routine. On slower machines
-			#   this function consumes precious CPU cycles.
-
 	config	TIMEZONE
 		string "TimeZone"
 		default "GMT"
@@ -949,8 +963,53 @@
 		default	"A4"		if PAGE_A4
 	#--- End Groff page
 
-#--- End Build Settings
-endmenu
+	config	HOSTNAME
+		string "Hostname"
+		default "**EDITME**"
+
+       menu "Network configuration"
+		config INTERFACE
+			string "netword card name"
+			default "eth0"
+		config IP_ADDR
+			string "Static IP address"
+			default "10.0.2.9"
+		config GATEWAY
+			string "Gateway"
+			default "10.0.2.2"
+		config PREFIX
+			string "Subnet prefix"
+			default "24"
+		config BROADCAST
+			string "Broadcast address"
+			default "10.0.2.255"
+		config DOMAIN
+			string "Domain name"
+			default "lfs.org"
+		config DNS1
+			string "Primary Name server"
+			default "10.0.2.3"
+		config DNS2
+			string "Secondary Name server"
+			default "8.8.8.8"
+	endmenu # Network configuration
+
+	menu "Console configuration"
+		config FONT
+			string "Console font"
+			default "lat0-16"
+		config FONTMAP
+			string "Font map (-m option to setfont)"
+			default "8859-1"
+		config UNICODE
+			bool "Unicode mode"
+			default y
+		config KEYMAP
+			string "Keymap name"
+			default "us"
+	endmenu # Console configuration
+
+endmenu        #--- System configuration
 
 menu "--- Advanced Features"
 

Modified: jhalfs/branches/new_features/LFS/lfs.xsl
==============================================================================
--- jhalfs/branches/new_features/LFS/lfs.xsl	Sun Dec 13 05:50:54 2015	(r3847)
+++ jhalfs/branches/new_features/LFS/lfs.xsl	Sun Dec 13 07:28:33 2015	(r3848)
@@ -8,6 +8,8 @@
       extension-element-prefixes="exsl"
       version="1.0">
 
+<!-- Parameters -->
+
   <!-- use package management ?
        n = no, original behavior
        y = yes, add PKG_DEST to scripts in install commands of chapter06-08
@@ -16,7 +18,7 @@
  
   <!-- Run test suites?
        0 = none
-       1 = only chapter06 Glibc, GCC and Binutils testsuites
+       1 = only chapter06 critical testsuites
        2 = all chapter06 testsuites
        3 = all chapter05 and chapter06 testsuites
   -->
@@ -43,6 +45,22 @@
   <!-- Install the whole set of locales -->
   <xsl:param name='full-locale' select='n'/>
   
+  <!-- Hostname -->
+  <xsl:param name='hostname' select='"HOSTNAME"'/>
+
+  <!-- Network parameters: interface, ip, gateway, prefix, broadcast, domain
+       and nameservers -->
+  <xsl:param name='interface'   select='eth0'/>
+  <xsl:param name='ip'          select='"10.0.2.9"'/>
+  <xsl:param name='gateway'     select='"10.0.2.2"'/>
+  <xsl:param name='prefix'      select='24'/>
+  <xsl:param name='broadcast'   select='"10.0.2.255"'/>
+  <xsl:param name='domain'      select='"lfs.org"'/>
+  <xsl:param name='nameserver1' select='"10.0.2.3"'/>
+  <xsl:param name='nameserver2' select='"8.8.8.8"'/>
+
+<!-- End parameters -->
+
   <xsl:template match="/">
     <xsl:apply-templates select="//sect1"/>
   </xsl:template>
@@ -499,6 +517,29 @@
       <xsl:when test="contains(string(.),'<ll>_<CC>')">
         <xsl:value-of select="$lang"/>
       </xsl:when>
+      <xsl:when test="contains(string(.),'Domain')">
+        <xsl:value-of select="$domain"/>
+      </xsl:when>
+      <xsl:when test="contains(string(.),'primary')">
+        <xsl:value-of select="$nameserver1"/>
+      </xsl:when>
+      <xsl:when test="contains(string(.),'secondary')">
+        <xsl:value-of select="$nameserver2"/>
+      </xsl:when>
+      <xsl:when test="contains(string(.),'192.168.1.1')">
+        <xsl:value-of select="$ip"/>
+      </xsl:when>
+      <xsl:when test="contains(string(.),'HOSTNAME')">
+        <xsl:value-of select="$hostname"/>
+        <xsl:text>.</xsl:text>
+        <xsl:value-of select="$domain"/>
+      </xsl:when>
+      <xsl:when test="contains(string(.),'alias')">
+        <xsl:value-of select="$hostname"/>
+      </xsl:when>
+      <xsl:when test="contains(string(.),'<lfs>')">
+        <xsl:value-of select="$hostname"/>
+      </xsl:when>
       <xsl:otherwise>
         <xsl:text>**EDITME</xsl:text>
         <xsl:apply-templates/>
@@ -507,6 +548,92 @@
     </xsl:choose>
   </xsl:template>
   
+  <xsl:template match="literal">
+    <xsl:choose>
+      <xsl:when test="contains(string(),'ONBOOT')">
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring" select="string()"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="outputnet">
+    <xsl:param name="netstring" select="''"/>
+    <!-- We suppose that book example has the following values:
+         - interface: eth0
+         - ip: 192.168.1.1
+         - gateway: 192.168.1.2
+         - prefix: 24
+         - broadcast: 192.168.1.255
+         Change below if book changes -->
+    <xsl:choose>
+      <xsl:when test="contains($netstring,'eth0')">
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-before($netstring,'eth0')"/>
+        </xsl:call-template>
+        <xsl:value-of select="$interface"/>
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-after($netstring,'eth0')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains($netstring,'192.168.1.1')">
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-before($netstring,'192.168.1.1')"/>
+        </xsl:call-template>
+        <xsl:value-of select="$ip"/>
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-after($netstring,'192.168.1.1')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <!-- must test this before the following, because 192.168.1.255 contains
+           192.168.1.2! -->
+      <xsl:when test="contains($netstring,'192.168.1.255')">
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-before($netstring,'192.168.1.255')"/>
+        </xsl:call-template>
+        <xsl:value-of select="$broadcast"/>
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-after($netstring,'192.168.1.255')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains($netstring,'192.168.1.2')">
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-before($netstring,'192.168.1.2')"/>
+        </xsl:call-template>
+        <xsl:value-of select="$gateway"/>
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-after($netstring,'192.168.1.2')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains($netstring,'24')">
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-before($netstring,'24')"/>
+        </xsl:call-template>
+        <xsl:value-of select="$prefix"/>
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-after($netstring,'24')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$netstring"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
   <xsl:template name="outputpkgdest">
     <xsl:param name="outputstring" select="foo"/>
     <xsl:choose>

Modified: jhalfs/branches/new_features/common/libs/func_book_parser
==============================================================================
--- jhalfs/branches/new_features/common/libs/func_book_parser	Sun Dec 13 05:50:54 2015	(r3847)
+++ jhalfs/branches/new_features/common/libs/func_book_parser	Sun Dec 13 07:28:33 2015	(r3848)
@@ -131,16 +131,25 @@
           bash process-scripts.sh >> $LOGDIR/$LOG 2>&1
         fi
         popd > /dev/null
-        xsltproc --nonet \
-                 --xinclude \
-                 --stringparam testsuite $TEST \
-                 --stringparam bomb-testsuite $BOMB_TEST \
-                 --stringparam vim-lang $VIMLANG \
-                 --stringparam full-locale $FULL_LOCALE \
-                 --stringparam timezone $TIMEZONE \
-                 --stringparam page $PAGE \
-                 --stringparam lang $LANG \
-                 --stringparam pkgmngt $PKGMNGT \
+        xsltproc --nonet                                   \
+                 --xinclude                                \
+                 --stringparam testsuite      $TEST        \
+                 --stringparam bomb-testsuite $BOMB_TEST   \
+                 --stringparam vim-lang       $VIMLANG     \
+                 --stringparam full-locale    $FULL_LOCALE \
+                 --stringparam timezone       $TIMEZONE    \
+                 --stringparam page           $PAGE        \
+                 --stringparam lang           $LANG        \
+                 --stringparam pkgmngt        $PKGMNGT     \
+                 --stringparam hostname       $HOSTNAME    \
+                 --stringparam interface      $INTERFACE   \
+                 --stringparam ip             $IP_ADDR     \
+                 --stringparam gateway        $GATEWAY     \
+                 --stringparam prefix         $PREFIX      \
+                 --stringparam broadcast      $BROADCAST   \
+                 --stringparam domain         $DOMAIN      \
+                 --stringparam nameserver1    $DNS1        \
+                 --stringparam nameserver2    $DNS2        \
                  -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
       ;;
     *)  echo -n " ${L_arrow}${PROGNAME}${R_arrow} book invalid, terminate build... "

Modified: jhalfs/branches/new_features/common/libs/func_validate_configs.sh
==============================================================================
--- jhalfs/branches/new_features/common/libs/func_validate_configs.sh	Sun Dec 13 05:50:54 2015	(r3847)
+++ jhalfs/branches/new_features/common/libs/func_validate_configs.sh	Sun Dec 13 07:28:33 2015	(r3848)
@@ -47,8 +47,11 @@
   local -r CLFS2_build="STRIP         VIMLANG $BUILD_common"
   local -r CLFS3_build="                      $BUILD_common"
 
+  # System Settings by book (only LFS for now)
+  local -r LFS_system="HOSTNAME INTERFACE IP_ADDR GATEWAY PREFIX BROADCAST DOMAIN DNS1 DNS2 FONT CONSOLE_MAP UNICODE KEYMAP"
+
   # Full list of books settings
-  local -r   lfs_PARAM_LIST="$LFS_book   $GENERAL_common $LFS_build   $ADVANCED_chroot $ADVANCED_common"
+  local -r   lfs_PARAM_LIST="$LFS_book   $GENERAL_common $LFS_build $LFS_system  $ADVANCED_chroot $ADVANCED_common"
   local -r  hlfs_PARAM_LIST="$HLFS_book  $GENERAL_common $HLFS_build  $ADVANCED_chroot $ADVANCED_common"
   local -r  clfs_PARAM_LIST="$CLFS_book  $GENERAL_common $CLFS_build  $ADVANCED_chroot $ADVANCED_common"
   local -r clfs2_PARAM_LIST="$CLFS2_book $GENERAL_common $CLFS2_build                  $ADVANCED_common"
@@ -184,6 +187,11 @@
                echo
                ;;
 
+        # Treatment of HOSTNAME
+      HOSTNAME)  echo -e "`eval echo $PARAM_VALS`"
+                 [[ "${!config_param}" = "**EDIT ME**" ]] && write_error_and_die
+                 ;;
+
       # Display non-validated envars found in ${PROGNAME}_PARAM_LIST
       * ) echo -e "`eval echo $PARAM_VALS`" ;;
 

Modified: jhalfs/branches/new_features/jhalfs
==============================================================================
--- jhalfs/branches/new_features/jhalfs	Sun Dec 13 05:50:54 2015	(r3847)
+++ jhalfs/branches/new_features/jhalfs	Sun Dec 13 07:28:33 2015	(r3848)
@@ -140,6 +140,7 @@
 SET_WARNINGS=${SET_WARNINGS:=n}
 SET_MISC=${SET_MISC:=n}
 SET_BLOWFISH=${SET_BLOWFISH:=n}
+UNICODE=${UNICODE:=n}
 
 if [[ "${NO_PROGRESS_BAR}" = "y" ]] ; then
 	NO_PROGRESS="#"


More information about the alfs-log mailing list