Changeset 9a4c530 for LFS/master.sh


Ignore:
Timestamp:
06/20/2020 04:45:26 PM (4 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
ablfs-more, legacy, trunk
Children:
7b33f40
Parents:
0a0753d
Message:

Clean LFS/master.sh from unused
functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LFS/master.sh

    r0a0753d r9a4c530  
    220220}
    221221
    222 # NOT USED -- NOT USED
    223 #----------------------------#
    224 chapter5_Makefiles() {
    225 #----------------------------#
    226   echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5     ( LUSER ) ${R_arrow}"
    227 
    228 # Initialize the Makefile target: it'll change during chapter
    229 # For vanilla lfs, the "changingowner" script should be run as root. So
    230 # it belongs to the "SUDO" target, with list in the "runasroot" variable.
    231 # For new lfs, changingowner and kernfs are in "runasroot", then the following,
    232 # starting at creatingdirs, are in the "CHROOT" target, in variable "chapter6".
    233 # Makefile_target records the variable, not really the target!
    234 # We use a case statement on that variable, because instructions in the
    235 # Makefile change according to the phase of the build (LUSER, SUDO, CHROOT).
    236   Makefile_target=chapter5
    237 
    238 # Start loop
    239   for file in chapter05/* ; do
    240     # Keep the script file name
    241     this_script=`basename $file`
    242 
    243     # Append each name of the script files to a list that Makefile_target
    244     # points to. But before that, change Makefile_target at the first script
    245     # of each target.
    246     case "${this_script}" in
    247       *changingowner) Makefile_target=runasroot ;;
    248       *creatingdirs ) Makefile_target=chapter6  ;; # only run for new lfs
    249     esac
    250     eval $Makefile_target=\"\$$Makefile_target ${this_script}\"
    251 
    252     # Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
    253     # and binutils in chapter 5)
    254     name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' \
    255                                     -e 's@-pass[0-9]\{1\}@@' \
    256                                     -e 's@-libstdc++@@'`
    257 
    258     #--------------------------------------------------------------------#
    259     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
    260     #--------------------------------------------------------------------#
    261     #
    262     # Find the name of the tarball and the version of the package
    263     pkg_tarball=$(sed -n 's/tar -xf \(.*\)/\1/p' $file)
    264     pkg_version=$(sed -n 's/VERSION=\(.*\)/\1/p' $file)
    265 
    266     # Drop in the name of the target on a new line, and the previous target
    267     # as a dependency. Also call the echo_message function.
    268     case $Makefile_target in
    269       chapter6) CHROOT_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
    270       *)        LUSER_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
    271     esac
    272 
    273     # If $pkg_tarball isn't empty, we've got a package...
    274     if [ "$pkg_tarball" != "" ] ; then
    275       # Always initialize the log file, since the test instructions may be
    276       # "uncommented" by the user
    277       case $Makefile_target in
    278        chapter6) CHROOT_wrt_test_log "${this_script}" "$pkg_version" ;;
    279        *)        LUSER_wrt_test_log "${this_script}" "$pkg_version" ;;
    280       esac
    281 
    282       # If using optimizations, write the instructions
    283       case "${OPTIMIZE}${this_script}${REALSBU}" in
    284           *binutils-pass1y) ;;
    285           2*) wrt_optimize "$name" && wrt_makeflags "$name" ;;
    286           *) ;;
    287       esac
    288     fi
    289 
    290     # Insert date and disk usage at the top of the log file, the script run
    291     # and date and disk usage again at the bottom of the log file.
    292     # The changingowner script must be run as root.
    293     case "${Makefile_target}" in
    294       runasroot)  wrt_RunAsRoot "$file" "$pkg_version" ;;
    295       chapter5)   LUSER_wrt_RunAsUser "$file" "$pkg_version" ;;
    296       chapter6)   CHROOT_wrt_RunAsRoot "$file" "$pkg_version" ;;
    297     esac
    298 
    299     # Include a touch of the target name so make can check
    300     # if it's already been made.
    301     wrt_touch
    302     #
    303     #--------------------------------------------------------------------#
    304     #              >>>>>>>> END OF Makefile ENTRY <<<<<<<<               #
    305     #--------------------------------------------------------------------#
    306 
    307     # Keep the script file name for Makefile dependencies.
    308     PREV=${this_script}
    309   done  # end for file in chapter05/*
    310 }
    311 
    312 # NOT USED -- NOT USED keep for ICA code
    313 #----------------------------#
    314 chapter6_Makefiles() {
    315 #----------------------------#
    316 
    317   # Set envars and scripts for iteration targets
    318   if [[ -z "$1" ]] ; then
    319     local N=""
    320   else
    321     local N=-build_$1
    322     local chapter6=""
    323     mkdir chapter06$N
    324     cp chapter06/* chapter06$N
    325     for script in chapter06$N/* ; do
    326       # Overwrite existing symlinks, files, and dirs
    327       sed -e 's/ln *-sv/&f/g' \
    328           -e 's/mv *-v/&f/g' \
    329           -e 's/mkdir *-v/&p/g' -i ${script}
    330       # Suppress the mod of "test-installation.pl" because now
    331       # the library path points to /usr/lib
    332       if [[ ${script} =~ glibc ]]; then
    333           sed '/DL=/,/unset DL/d' -i ${script}
    334       fi
    335       # Rename the scripts
    336       mv ${script} ${script}$N
    337     done
    338     # Remove Bzip2 binaries before make install (LFS-6.2 compatibility)
    339     sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2$N
    340     # Remove openssl-<version> from /usr/share/doc (LFS-9.x), because
    341     # otherwise the mv command creates an openssl directory.
    342     sed -e 's@mv -v@rm -rfv /usr/share/doc/openssl-*\n&@' \
    343         -i chapter06$N/*-openssl$N
    344   fi
    345 
    346   echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N     ( CHROOT ) ${R_arrow}"
    347 
    348 # Initialize the Makefile target. In vanilla lfs, kernfs should be run as root,
    349 # then the others are run in chroot. If in new lfs, we should start in chroot.
    350 # this will be changed later because man-pages is the first script in
    351 # chapter 6. Note that this Makefile_target business is not really needed here
    352 # but we do it to have a similar structure to chapter 5 (we may merge all
    353 # those functions at some point).
    354   case "$N" in
    355      -build*) Makefile_target=chapter6   ;;
    356            *) Makefile_target=runasroot  ;;
    357   esac
    358 
    359 # Start loop
    360   for file in chapter06$N/* ; do
    361     # Keep the script file name
    362     this_script=`basename $file`
    363 
    364     # Skip the "stripping" scripts if the user does not want to strip.
    365     # Skip also linux-headers in iterative builds.
    366     case "${this_script}" in
    367       *stripping*) [[ "${STRIP}" = "n" ]] && continue ;;
    368       *linux-headers*) [[ -n "$N" ]] && continue ;;
    369     esac
    370 
    371     # Grab the name of the target.
    372     name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' -e 's,'$N',,'`
    373 
    374     # Find the tarball corresponding to our script.
    375     # If it doesn't exist, we skip it in iterations rebuilds (except stripping
    376     # and revisedchroot, where .a and .la files are removed).
    377     pkg_tarball=$(sed -n 's/tar -xf \(.*\)/\1/p' $file)
    378     pkg_version=$(sed -n 's/VERSION=\(.*\)/\1/p' $file)
    379 
    380     if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
    381       case "${this_script}" in
    382         *stripping*|*revised*) ;;
    383         *)  continue ;;
    384       esac
    385     fi
    386 
    387     # Append each name of the script files to a list (this will become
    388     # the names of the targets in the Makefile)
    389     # The kernfs script must be run as part of SUDO target.
    390     case "${this_script}" in
    391             *creatingdirs) Makefile_target=chapter6 ;;
    392             *man-pages   ) Makefile_target=chapter6 ;;
    393     esac
    394     eval $Makefile_target=\"\$$Makefile_target ${this_script}\"
    395 
    396     #--------------------------------------------------------------------#
    397     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
    398     #--------------------------------------------------------------------#
    399     #
    400     # Drop in the name of the target on a new line, and the previous target
    401     # as a dependency. Also call the echo_message function.
    402     # In the mount of kernel filesystems we need to set LFS
    403     # and not to use chroot.
    404     case "${Makefile_target}" in
    405       runasroot)  LUSER_wrt_target  "${this_script}" "$PREV" "$pkg_version" ;;
    406       *)          CHROOT_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
    407     esac
    408 
    409     # If $pkg_tarball isn't empty, we've got a package...
    410     # Insert instructions for unpacking the package and changing directories
    411     if [ "$pkg_tarball" != "" ] ; then
    412       # Touch timestamp file if installed files logs will be created.
    413       # But only for the firt build when running iterative builds.
    414       if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
    415         CHROOT_wrt_TouchTimestamp
    416       fi
    417       # Always initialize the log file, so that the user may reinstate a
    418       # commented out test
    419       CHROOT_wrt_test_log "${this_script}" "$pkg_version"
    420       # If using optimizations, write the instructions
    421       [[ "$OPTIMIZE" != "0" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
    422     fi
    423 
    424     # In the mount of kernel filesystems we need to set LFS
    425     # and not to use chroot.
    426     case "${Makefile_target}" in
    427       runasroot)  wrt_RunAsRoot  "$file" "$pkg_version" ;;
    428       *)          CHROOT_wrt_RunAsRoot "$file" "$pkg_version" ;;
    429     esac
    430 
    431     # Write installed files log and remove the build directory(ies)
    432     # except if the package build fails.
    433     if [ "$pkg_tarball" != "" ] ; then
    434       if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
    435         CHROOT_wrt_LogNewFiles "$name"
    436       fi
    437     fi
    438 
    439     # Include a touch of the target name so make can check
    440     # if it's already been made.
    441     wrt_touch
    442     #
    443     #--------------------------------------------------------------------#
    444     #              >>>>>>>> END OF Makefile ENTRY <<<<<<<<               #
    445     #--------------------------------------------------------------------#
    446 
    447     # Keep the script file name for Makefile dependencies.
    448     PREV=${this_script}
    449     # Set system_build envar for iteration targets
    450     if [ -z "$N" ]; then
    451       system_build="$system_build $this_script"
    452     fi
    453   done # end for file in chapter06/*
    454   if [ -n "$N" ]; then
    455     system_build="$chapter6"
    456   fi
    457 }
    458 # NOT USED -- NOT USED
    459 #----------------------------#
    460 chapter78_Makefiles() {
    461 #----------------------------#
    462   echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8   ( BOOT ) ${R_arrow}"
    463 
    464   for file in chapter0{7,8}/* ; do
    465     # Keep the script file name
    466     this_script=`basename $file`
    467 
    468     # Grub must be configured manually.
    469     # Handle fstab creation.
    470     # If no .config file is supplied, the kernel build is skipped
    471     case ${this_script} in
    472       *grub)    continue ;;
    473       *fstab)   [[ -z "${FSTAB}" ]] ||
    474                 [[ ${FSTAB} == $BUILDDIR/sources/fstab ]] ||
    475                 cp ${FSTAB} $BUILDDIR/sources/fstab ;;
    476       *kernel)  [[ -z ${CONFIG} ]] && continue
    477                 [[ ${CONFIG} == $BUILDDIR/sources/kernel-config ]] ||
    478                 cp ${CONFIG} $BUILDDIR/sources/kernel-config  ;;
    479     esac
    480 
    481     # First append each name of the script files to a list (this will become
    482     # the names of the targets in the Makefile
    483     chapter78="$chapter78 ${this_script}"
    484 
    485     #--------------------------------------------------------------------#
    486     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
    487     #--------------------------------------------------------------------#
    488     #
    489     # Drop in the name of the target on a new line, and the previous target
    490     # as a dependency. Also call the echo_message function.
    491     CHROOT_wrt_target "${this_script}" "$PREV"
    492 
    493     # Find the bootscripts or networkscripts (for systemd)
    494     # and kernel package names
    495     case "${this_script}" in
    496       *bootscripts)
    497             name="lfs-bootscripts"
    498             if [ "${INSTALL_LOG}" = "y" ] ; then
    499               CHROOT_wrt_TouchTimestamp
    500             fi
    501         ;;
    502       *network-scripts)
    503             name="lfs-network-scripts"
    504             if [ "${INSTALL_LOG}" = "y" ] ; then
    505               CHROOT_wrt_TouchTimestamp
    506             fi
    507         ;;
    508       *kernel)
    509             name="linux"
    510             if [ "${INSTALL_LOG}" = "y" ] ; then
    511               CHROOT_wrt_TouchTimestamp
    512             fi
    513             # If using optimizations, use MAKEFLAGS (unless blacklisted)
    514             # no setting of CFLAGS and friends.
    515             [[ "$OPTIMIZE" != "0" ]] &&  wrt_makeflags "$name"
    516        ;;
    517     esac
    518 
    519       # Check if we have a real /etc/fstab file
    520     case "${this_script}" in
    521       *fstab) if [[ -n "$FSTAB" ]]; then
    522                 CHROOT_wrt_CopyFstab
    523               else
    524                 CHROOT_wrt_RunAsRoot "$file"
    525               fi
    526         ;;
    527       *)        CHROOT_wrt_RunAsRoot "$file"
    528         ;;
    529     esac
    530 
    531     case "${this_script}" in
    532       *bootscripts|*network-scripts|*kernel)
    533                          if [ "${INSTALL_LOG}" = "y" ] ; then
    534                            CHROOT_wrt_LogNewFiles "$name"
    535                          fi ;;
    536     esac
    537     # Include a touch of the target name so make can check
    538     # if it's already been made.
    539     wrt_touch
    540     #
    541     #--------------------------------------------------------------------#
    542     #              >>>>>>>> END OF Makefile ENTRY <<<<<<<<               #
    543     #--------------------------------------------------------------------#
    544 
    545     # Keep the script file name for Makefile dependencies.
    546     PREV=${this_script}
    547   done  # for file in chapter0{7,8}/*
    548 
    549 }
    550 
    551222#----------------------------#
    552223build_Makefile() {           #
Note: See TracChangeset for help on using the changeset viewer.