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
This commit is contained in:
Pierre Labastie 2015-12-13 15:28:33 +00:00
parent 2453b766d0
commit 77fa8baa59
5 changed files with 247 additions and 43 deletions

117
Config.in
View file

@ -760,7 +760,7 @@ menu "--- Build Settings"
#
# 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,19 +774,38 @@ menu "--- Build Settings"
# - 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
choice
prompt "Flavour"
config NO_BOMB
bool "Don't stop on test failures"
config BOMB
bool "Abort the build on the first test failure"
endchoice
config TEST
@ -796,23 +815,13 @@ menu "--- Build Settings"
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"
config BOMB
bool "Abort the build on the first testsuite failure"
endchoice
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 @@ menu "--- Build Settings"
#--- 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 @@ menu "--- Build Settings"
# 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 @@ menu "--- Build Settings"
# 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 @@ menu "--- Build Settings"
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"

View file

@ -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 @@ unset OLD_PKGDIR
<xsl:when test="contains(string(.),'&lt;ll&gt;_&lt;CC&gt;')">
<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(.),'&lt;lfs&gt;')">
<xsl:value-of select="$hostname"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>**EDITME</xsl:text>
<xsl:apply-templates/>
@ -507,6 +548,92 @@ unset OLD_PKGDIR
</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>

View file

@ -141,6 +141,15 @@ extract_commands() { #
--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... "

View file

@ -47,8 +47,11 @@ inline_doc
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 @@ inline_doc
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`" ;;

1
jhalfs
View file

@ -140,6 +140,7 @@ SET_HARDENED_TMP=${SET_HARDENED_TMP:=n}
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="#"