[jhalfs] 03/06: LFS book version: tidy up extraction
"Git Owner" ([email protected] via alfs-discuss Mailing List) <[email protected]> Sat, 25 Apr 2026 16:46:49 +0000
| Newsgroups | gmane.linux.lfs.automated |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format... ------------=_1777135620-1253-26067 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit This is an automated email from the git hooks/post-receive script. git pushed a commit to branch trunk in repository jhalfs. commit abc2a74df9fb10e51aa8943f88639fef5b8faa4a Author: Pierre Labastie <[email protected]> AuthorDate: Sat Apr 25 15:06:24 2026 +0200 LFS book version: tidy up extraction We take the book version from the "echo ... >/etc/lfs-release" line. But the problem is that ... may be either: - an unquoted string with no specail characters. We then need to keep everything that is not a space character. - a quoted string with possibly special characters. We then need to remove quotesand keep everything that is in between quotes. This is done in a funciton "extract_version", and then used everywhere needed. This fix some issues for multilib reported by Eric Clothier on the alfs-discuss mailing list. --- common/libs/func_book_parser | 17 +++++++++++++---- jhalfs | 13 +++++++------ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/common/libs/func_book_parser b/common/libs/func_book_parser index f7ec163..ef9e019 100644 --- a/common/libs/func_book_parser +++ b/common/libs/func_book_parser @@ -137,10 +137,8 @@ extract_commands() { # create_chroot_scripts create_kernfs_scripts - # we create the VERSION variable here. Should maybe go into its own - # function. But at this point we can use the profiled xml to get - # version from lfs-release in the lfs case. - VERSION=$(grep 'echo.*lfs-release' prbook.xml | sed 's/.*echo[ ]*\([^ ]*\).*/\1/') + # we create the VERSION variable here. + extract_version # Done. Moving on... get_sources @@ -183,3 +181,14 @@ create_kernfs_scripts() { # echo "done" } + +#---------------------------# +extract_version() { # +#---------------------------# + + declare -g VERSION="$(grep echo.*lfs-release prbook.xml | sed s/.*echo//)" + case "$VERSION" in + *\"*) VERSION="$(echo $VERSION | sed 's/[^"]*"\([^"]*\).*/\1/')" ;; + *) VERSION="$(echo $VERSION | sed 's/[ ]*\([^ ]*\).*/\1/')" ;; + esac +} diff --git a/jhalfs b/jhalfs index e35b011..a319123 100755 --- a/jhalfs +++ b/jhalfs @@ -393,7 +393,7 @@ if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then [[ ${PIPESTATUS[0]} != 0 ]] && exit 1 fi -fi +fi # $REBUILD_MAKEFILE = n # shellcheck disable=SC2034 if [[ "$REBUILD_MAKEFILE" = "y" ]] ; then @@ -405,7 +405,7 @@ if [[ "$REBUILD_MAKEFILE" = "y" ]] ; then fi # When regenerating the Makefile, we need to know also the # canonical book version -VERSION=$(grep 'echo.*lfs-release' "$JHALFSDIR/prbook.xml" | sed 's/.*echo[ ]*\([^ ]*\).*/\1/') + extract_version fi build_Makefile @@ -413,9 +413,10 @@ build_Makefile echo "${SD_BORDER}${nl_}" # Check for build prerequisites. - echo - cd "$CWD" - check_prerequisites - echo "${SD_BORDER}${nl_}" +echo +cd "$CWD" +check_prerequisites +echo "${SD_BORDER}${nl_}" + # All is well, run the build (if requested) run_make -- To stop receiving notification emails like this one, please contact the administrator of this repository. ------------=_1777135620-1253-26067 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- http://lists.linuxfromscratch.org/sympa/info/alfs-discuss Unsubscribe: See the above information page ------------=_1777135620-1253-26067--