Changeset 3261fe7


Ignore:
Timestamp:
03/29/2020 05:16:09 PM (5 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
ablfs-more, legacy, trunk
Children:
04de9bc
Parents:
4762fb9
Message:

Adapt master.sh to new book, staying compatible

This involves changing the way make targets are built. Specially
the make target is changed when encountering a specific file
(for example the make target becomes sudo when rencountering kernfs)
This allows more flexibility.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LFS/master.sh

    r4762fb9 r3261fe7  
    9898  echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5     ( LUSER ) ${R_arrow}"
    9999
     100# Initialize the Makefile target: it'll change during chapter
     101# For vanilla lfs, the "changingowner" script should be run as root. So
     102# it belongs to the "SUDO" target, with list in the "runasroot" variable.
     103# For new lfs, changingowner and kernfs are in "runsaroot", then the following,
     104# starting at creatingdirs, are in the "CHROOT" target, in variable "chapter6".
     105# Makefile_target records the variable, not really the target!
     106# We use a case statement on that variable, because instructions in the
     107# Makefile change according to the phase of the build (LUSER, SUDO, CHROOT).
     108  Makefile_target=chapter5
     109
     110# Start loop
    100111  for file in chapter05/* ; do
    101112    # Keep the script file name
    102113    this_script=`basename $file`
    103114
    104     # If no testsuites are run, then TCL, Expect, DejaGNU and Check
    105     # aren't needed (but building them does not hurt).
    106     # Fix also locales creation when running chapter05 testsuites (ugly)
    107     case "${this_script}" in
    108 #      *tcl)       [[ "${TEST}" = "0" ]] && continue ;;
    109 #      *expect)    [[ "${TEST}" = "0" ]] && continue ;;
    110 #      *dejagnu)   [[ "${TEST}" = "0" ]] && continue ;;
    111 #      *check)     [[ "${TEST}" = "0" ]] && continue ;;
    112 # We now do that in LFS.xsl, because stripping.xml contains other cleaning
    113 # instructions
    114 #      *stripping) [[ "${STRIP}" = "n" ]] && continue ;;
     115    # Fix locales creation when running chapter05 testsuites (ugly)
     116    case "${this_script}" in
    115117      *glibc)     [[ "${TEST}" = "3" ]] && \
    116118                  sed -i 's@/usr/lib/locale@/tools/lib/locale@' $file ;;
    117119    esac
    118120
    119     # First append each name of the script files to a list (this will become
    120     # the names of the targets in the Makefile
    121     # DO NOT append the changingowner script, it need be run as root.
    122     # A hack is necessary: create script in chap5 BUT run as a dependency for
    123     # SUDO target
    124     case "${this_script}" in
    125       *changingowner) runasroot="$runasroot ${this_script}" ;;
    126                    *) chapter5="$chapter5 ${this_script}" ;;
    127     esac
     121    # Append each name of the script files to a list that Makefile_target
     122    # points to. But before that, change Makefile_target at the first script
     123    # of each target.
     124    case "${this_script}" in
     125      *changingowner) Makefile_target=runasroot ;;
     126      *creatingdirs ) Makefile_target=chapter6  ;; # only run for new lfs
     127    esac
     128    eval $Makefile_target=\"\$$Makefile_target ${this_script}\"
    128129
    129130    # Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
     
    143144    # Drop in the name of the target on a new line, and the previous target
    144145    # as a dependency. Also call the echo_message function.
    145     LUSER_wrt_target "${this_script}" "$PREV" "$pkg_version"
     146    case $Makefile_target in
     147      chapter6) CHROOT_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
     148      *)        LUSER_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
     149    esac
    146150
    147151    # If $pkg_tarball isn't empty, we've got a package...
     
    149153      # Always initialize the log file, since the test instructions may be
    150154      # "uncommented" by the user
    151       LUSER_wrt_test_log "${this_script}" "$pkg_version"
     155      case $Makefile_target in
     156       chapter6) CHROOT_wrt_test_log "${this_script}" "$pkg_version" ;;
     157       *)        LUSER_wrt_test_log "${this_script}" "$pkg_version" ;;
     158      esac
     159
    152160      # If using optimizations, write the instructions
    153161      case "${OPTIMIZE}${this_script}${REALSBU}" in
     
    161169    # and date and disk usage again at the bottom of the log file.
    162170    # The changingowner script must be run as root.
    163     case "${this_script}" in
    164       *changingowner)  wrt_RunAsRoot "$file" "$pkg_version" ;;
    165       *)               LUSER_wrt_RunAsUser "$file" "$pkg_version" ;;
     171    case "${Makefile_target}" in
     172      runasroot)  wrt_RunAsRoot "$file" "$pkg_version" ;;
     173      chapter5)   LUSER_wrt_RunAsUser "$file" "$pkg_version" ;;
     174      chapter6)   CHROOT_wrt_RunAsRoot "$file" "$pkg_version" ;;
    166175    esac
    167176
     
    211220  echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N     ( CHROOT ) ${R_arrow}"
    212221
     222# Initialize the Makefile target. In vanilla lfs, kernfs should be run as root,
     223# then the others are run in chroot. If in new lfs, we should start in chroot.
     224# this will be changed later because man-pages is the first script in
     225# chapter 6. Note that this Makefile_target business is not really needed here
     226# but we do it to have a similar structure to chapter 5 (we may merge all
     227# those functions at some point).
     228  Makefile_target=runasroot
     229
     230# Start loop
    213231  for file in chapter06$N/* ; do
    214232    # Keep the script file name
     
    226244
    227245    # Find the tarball corresponding to our script.
    228     # If it doesn't, we skip it in iterations rebuilds (except stripping).
     246    # If it doesn't exist, we skip it in iterations rebuilds (except stripping).
    229247    pkg_tarball=$(sed -n 's/tar -xf \(.*\)/\1/p' $file)
    230248    pkg_version=$(sed -n 's/VERSION=\(.*\)/\1/p' $file)
     
    241259    # The kernfs script must be run as part of SUDO target.
    242260    case "${this_script}" in
    243       *kernfs) runasroot="$runasroot ${this_script}" ;;
    244             *) chapter6="$chapter6 ${this_script}" ;;
    245     esac
     261            *creatingdirs) Makefile_target=chapter6 ;;
     262            *man-pages   ) Makefile_target=chapter6 ;;
     263    esac
     264    eval $Makefile_target=\"\$$Makefile_target ${this_script}\"
    246265
    247266    #--------------------------------------------------------------------#
     
    253272    # In the mount of kernel filesystems we need to set LFS
    254273    # and not to use chroot.
    255     case "${this_script}" in
    256       *kernfs)  LUSER_wrt_target  "${this_script}" "$PREV" "$pkg_version" ;;
    257       *)        CHROOT_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
     274    case "${Makefile_target}" in
     275      runasroot)  LUSER_wrt_target  "${this_script}" "$PREV" "$pkg_version" ;;
     276      *)          CHROOT_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
    258277    esac
    259278
     
    266285        CHROOT_wrt_TouchTimestamp
    267286      fi
    268       # Always initialize the log file, so that the use may reinstate a
     287      # Always initialize the log file, so that the user may reinstate a
    269288      # commented out test
    270289      CHROOT_wrt_test_log "${this_script}" "$pkg_version"
     
    275294    # In the mount of kernel filesystems we need to set LFS
    276295    # and not to use chroot.
    277     case "${this_script}" in
    278       *kernfs)  wrt_RunAsRoot  "$file" "$pkg_version" ;;
    279       *)        CHROOT_wrt_RunAsRoot "$file" "$pkg_version" ;;
     296    case "${Makefile_target}" in
     297      runasroot)  wrt_RunAsRoot  "$file" "$pkg_version" ;;
     298      *)          CHROOT_wrt_RunAsRoot "$file" "$pkg_version" ;;
    280299    esac
    281300
Note: See TracChangeset for help on using the changeset viewer.