From c9598f21080e67588c232082a97c12aef449d0d1 Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Sat, 28 May 2016 10:00:30 +0000 Subject: [PATCH] Adaptation for merged LFS books. A few typos with no consequence are corrected too. --- Config.in | 20 ++-- common/libs/func_book_parser | 148 ++++++++++++++++----------- common/libs/func_download_pkgs | 34 +++--- common/libs/func_validate_configs.sh | 2 +- common/packages.xsl | 13 ++- common/urls.xsl | 12 ++- jhalfs | 9 +- 7 files changed, 150 insertions(+), 88 deletions(-) diff --git a/Config.in b/Config.in index 21f074a..d04b3cf 100644 --- a/Config.in +++ b/Config.in @@ -8,7 +8,10 @@ menu "--- BOOK Settings" #-- Select the BOOK/Build style you wish to configure. config BOOK_LFS - bool "Linux From Scratch" + bool "Linux From Scratch System V" + + config BOOK_LFS_SYSD + bool "Linux From Scratch systemd" config BOOK_CLFS bool "Cross-Compiled Linux From Scratch" @@ -23,9 +26,14 @@ menu "--- BOOK Settings" # bool "Hardened Linux From Scratch" endchoice + config INITSYS + string + default "sysv" if BOOK_LFS + default "systemd" if BOOK_LFS_SYSD + config PROGNAME string - default "lfs" if BOOK_LFS + default "lfs" if BOOK_LFS || BOOK_LFS_SYSD default "clfs" if BOOK_CLFS default "clfs2" if BOOK_CLFS2 default "clfs3" if BOOK_CLFS3 @@ -39,11 +47,11 @@ menu "--- BOOK Settings" #--- Book version choice prompt "Release" - default relSVN if BOOK_LFS || BOOK_HLFS + default relSVN if BOOK_LFS || BOOK_HLFS || BOOK_LFS_SYSD default relGIT if BOOK_CLFS || BOOK_CLFS2 || BOOK_CLFS3 config relSVN bool "SVN" - depends on BOOK_LFS || BOOK_HLFS + depends on BOOK_LFS || BOOK_HLFS || BOOK_LFS_SYSD help #-- Current development version as in trunk @@ -624,7 +632,7 @@ menu "--- General Settings" config DEF_USER string - default "lfs" if BOOK_LFS + default "lfs" if BOOK_LFS || BOOK_LFS_SYSD default "clfs" if BOOK_CLFS || BOOK_CLFS2 || BOOK_CLFS3 default "hlfs" if BOOK_HLFS @@ -817,7 +825,7 @@ menu "--- Build Settings" #--- Package Management config PKGMNGT bool "Package management" - depends BOOK_LFS + depends BOOK_LFS || BOOK_LFS_SYSD default n help #-- Use package management diff --git a/common/libs/func_book_parser b/common/libs/func_book_parser index 36364ba..3170018 100644 --- a/common/libs/func_book_parser +++ b/common/libs/func_book_parser @@ -8,7 +8,7 @@ get_book() { # cd $JHALFSDIR if [ -z $WORKING_COPY ] ; then - # Check for Subversion instead of just letting the script hit 'svn' and fail. +# Check for Subversion instead of just letting the script hit 'svn' and fail. test `type -p svn` || eval "echo \"This feature requires Subversion.\" exit 1" echo -n "Downloading the $PROGNAME document, $LFSVRS version... " @@ -23,9 +23,11 @@ get_book() { # # Grab a fresh book if it's missing, otherwise, update it from the # repo. If we've already extracted the commands, move on to getting the # sources. - if [ $PROGNAME == "lfs" ] || [ $PROGNAME == "hlfs" ] && [ ! -d ${PROGNAME}-${LFSVRS}/.svn ]; then + if [ $PROGNAME == "lfs" ] || [ $PROGNAME == "hlfs" ] && + [ ! -d ${PROGNAME}-${LFSVRS}/.svn ]; then svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 - elif [ $PROGNAME == "clfs" ] || [ $PROGNAME == "clfs2" ] || [ $PROGNAME == "clfs3" ] && [ ! -d ${PROGNAME}-${LFSVRS}/.git ]; then + elif [ $PROGNAME == "clfs" ] || [ $PROGNAME == "clfs2" ] || + [ $PROGNAME == "clfs3" ] && [ ! -d ${PROGNAME}-${LFSVRS}/.git ]; then echo $TREE git clone $GIT ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 if [ ! $TREE == "development" ]; then @@ -60,6 +62,13 @@ extract_commands() { # case $PROGNAME in clfs*) VERSION=$(xmllint --noent $BOOK/BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; + lfs) + if [ "$INITSYS" = "sysv" ] ; then + VERSION=$(grep 'ENTITY version ' $BOOK/general.ent| cut -d\" -f2) + else + VERSION=$(grep 'ENTITY versiond' $BOOK/general.ent| cut -d\" -f2) + fi + ;; *) VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; esac @@ -72,57 +81,66 @@ extract_commands() { # case ${PROGNAME} in clfs) echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... " - xsltproc --nonet \ - --xinclude \ - --stringparam method $METHOD \ - --stringparam testsuite $TEST \ + xsltproc --nonet \ + --xinclude \ + --stringparam method $METHOD \ + --stringparam testsuite $TEST \ --stringparam bomb-testsuite $BOMB_TEST \ - --stringparam vim-lang $VIMLANG \ - --stringparam timezone $TIMEZONE \ - --stringparam page $PAGE \ - --stringparam lang $LANG \ - --stringparam sparc $SPARC64_PROC \ - --stringparam x86 $TARGET \ - --stringparam mips $TARGET \ - -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 + --stringparam vim-lang $VIMLANG \ + --stringparam timezone $TIMEZONE \ + --stringparam page $PAGE \ + --stringparam lang $LANG \ + --stringparam sparc $SPARC64_PROC \ + --stringparam x86 $TARGET \ + --stringparam mips $TARGET \ + -o ./${PROGNAME}-commands/ \ + $XSL \ + $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 ;; clfs2) echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... " - xsltproc --nonet \ - --xinclude \ - --stringparam vim-lang $VIMLANG \ + xsltproc --nonet \ + --xinclude \ + --stringparam vim-lang $VIMLANG \ --stringparam timezone $TIMEZONE \ - --stringparam page $PAGE \ - --stringparam lang $LANG \ - -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 + --stringparam page $PAGE \ + --stringparam lang $LANG \ + --output ./${PROGNAME}-commands/ \ + $XSL \ + $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 ;; clfs3) echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... " - xsltproc --nonet \ - --xinclude \ - --stringparam endian x$ENDIAN \ + xsltproc --nonet \ + --xinclude \ + --stringparam endian x$ENDIAN \ --stringparam timezone $TIMEZONE \ - --stringparam page $PAGE \ - --stringparam lang $LANG \ - -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 + --stringparam page $PAGE \ + --stringparam lang $LANG \ + --output ./${PROGNAME}-commands/ \ + $XSL \ + $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 ;; hlfs) echo -n " ${L_arrow}${BOLD}$MODEL + $KERNEL${R_arrow} HLFS flavour... " - xsltproc --nonet \ - --xinclude \ - --stringparam model $MODEL \ - --stringparam kernel $KERNEL \ - --stringparam testsuite $TEST \ - --stringparam bomb-testsuite $BOMB_TEST \ - --stringparam features x$SSP$ASLR$PAX$HARDENED_TMP$WARNINGS$MISC$BLOWFISH \ - --stringparam timezone $TIMEZONE \ - --stringparam page $PAGE \ - --stringparam lang $LANG \ - --stringparam grsecurity_host $GRSECURITY_HOST \ - -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1 + xsltproc --nonet \ + --xinclude \ + --stringparam model $MODEL \ + --stringparam kernel $KERNEL \ + --stringparam testsuite $TEST \ + --stringparam bomb-testsuite $BOMB_TEST \ + --stringparam features \ + x$SSP$ASLR$PAX$HARDENED_TMP$WARNINGS$MISC$BLOWFISH \ + --stringparam timezone $TIMEZONE \ + --stringparam page $PAGE \ + --stringparam lang $LANG \ + --stringparam grsecurity_host $GRSECURITY_HOST \ + --output ./${PROGNAME}-commands/ \ + $XSL \ + $BOOK/index.xml >>$LOGDIR/$LOG 2>&1 ;; lfs) echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build... " @@ -131,17 +149,28 @@ extract_commands() { # 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 \ - -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1 + + xsltproc --nonet \ + --xinclude \ + --output /tmp/lfs-full.xml \ + --stringparam profile.revision $INITSYS \ + $BOOK/stylesheets/lfs-xsl/profile.xsl \ + $BOOK/index.xml + + xsltproc --nonet \ + --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 \ + --output ./${PROGNAME}-commands/ \ + $XSL \ + /tmp/lfs-full.xml >>$LOGDIR/$LOG 2>&1 + + rm /tmp/lfs-full.xml ;; *) echo -n " ${L_arrow}${PROGNAME}${R_arrow} book invalid, terminate build... " exit 1 ;; @@ -172,20 +201,25 @@ create_package_list() { # echo -n "... " case ${PROGNAME} in clfs*) - xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \ + xsltproc --nonet --xinclude \ + -o pkg_tarball_list \ + packages.xsl \ $BOOK/BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1 ;; hlfs) - xsltproc --nonet --xinclude \ - --stringparam model $MODEL \ + xsltproc --nonet --xinclude \ + --stringparam model $MODEL \ --stringparam kernel $KERNEL \ - -o pkg_tarball_list packages.xsl \ + --output pkg_tarball_list \ + packages.xsl \ $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1 ;; lfs) - xsltproc --nonet --xinclude \ - --stringparam pkgmngt $PKGMNGT \ - -o pkg_tarball_list packages.xsl \ + xsltproc --nonet --xinclude \ + --stringparam pkgmngt $PKGMNGT \ + --stringparam revision $INITSYS \ + --output pkg_tarball_list \ + packages.xsl \ $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1 ;; *) diff --git a/common/libs/func_download_pkgs b/common/libs/func_download_pkgs index d441005..f70c69b 100644 --- a/common/libs/func_download_pkgs +++ b/common/libs/func_download_pkgs @@ -150,31 +150,35 @@ create_urls() { # case ${PROGNAME} in clfs*) echo -n "Creating CLFS <${ARCH}> specific URLs file" - xsltproc --nonet --xinclude \ - --stringparam server $SERVER \ - --stringparam family clfs \ - -o $BUILDDIR/sources/urls.lst urls.xsl \ + xsltproc --nonet --xinclude \ + --stringparam server $SERVER \ + --stringparam family clfs \ + -o $BUILDDIR/sources/urls.lst \ + urls.xsl \ $BOOK/BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1 echo " ...OK" ;; hlfs) echo -n "Creating HLFS <${MODEL}> + <${KERNEL}> specific URLs file" - xsltproc --nonet --xinclude \ - --stringparam server $SERVER \ - --stringparam family lfs \ - --stringparam model $MODEL \ - --stringparam kernel $KERNEL \ - -o $BUILDDIR/sources/urls.lst urls.xsl \ + xsltproc --nonet --xinclude \ + --stringparam server $SERVER \ + --stringparam family lfs \ + --stringparam model $MODEL \ + --stringparam kernel $KERNEL \ + -o $BUILDDIR/sources/urls.lst \ + urls.xsl \ $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1 echo " ...OK" ;; lfs) echo -n "Creating LFS specific URLs file" - xsltproc --nonet --xinclude \ - --stringparam server $SERVER \ - --stringparam family lfs \ - --stringparam pkgmngt $PKGMNGT \ - -o ../sources/urls.lst urls.xsl \ + xsltproc --nonet --xinclude \ + --stringparam server $SERVER \ + --stringparam family lfs \ + --stringparam pkgmngt $PKGMNGT \ + --stringparam revision $INITSYS \ + --output ../sources/urls.lst \ + urls.xsl \ $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1 echo " ...OK" ;; diff --git a/common/libs/func_validate_configs.sh b/common/libs/func_validate_configs.sh index 7e05f55..64d1146 100644 --- a/common/libs/func_validate_configs.sh +++ b/common/libs/func_validate_configs.sh @@ -31,7 +31,7 @@ inline_doc local -r ADVANCED_common="REPORT REBUILD_MAKEFILE" # BOOK Settings by book - local -r LFS_book="$BOOK_common BLFS_TOOL" + local -r LFS_book="$BOOK_common REV BLFS_TOOL" #local -r HLFS_added="SET_SSP SET_ASLR SET_PAX SET_HARDENED_TMP SET_WARNINGS \ # SET_MISC SET_BLOWFISH" local -r HLFS_added="" diff --git a/common/packages.xsl b/common/packages.xsl index 41645f4..f77801f 100644 --- a/common/packages.xsl +++ b/common/packages.xsl @@ -8,13 +8,16 @@ - + - + - - + + + + + @@ -28,6 +31,8 @@ diff --git a/common/urls.xsl b/common/urls.xsl index 511d183..bcdf78c 100644 --- a/common/urls.xsl +++ b/common/urls.xsl @@ -14,16 +14,20 @@ lfs - + - + - + + + + - + diff --git a/jhalfs b/jhalfs index cf0e3e5..5d2609f 100755 --- a/jhalfs +++ b/jhalfs @@ -440,8 +440,15 @@ if [[ "$REBUILD_MAKEFILE" = "y" ]] ; then case $PROGNAME in clfs* ) VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; + lfs) + if [[ "$INITSYS" = "sysv" ]] ; then + VERSION=$(grep 'ENTITY version ' $JHALFSDIR/$BOOK/general.ent| cut -d\" -f2) + else + VERSION=$(grep 'ENTITY versiond' $JHALFSDIR/$BOOK/general.ent| cut -d\" -f2) + fi + ;; *) - VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; + VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; esac fi