Changeset 045b2dc for CLFS2


Ignore:
Timestamp:
10/02/2006 07:32:06 PM (18 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
2.3, 2.3.x, 2.4, ablfs, ablfs-more, legacy, new_features, trunk
Children:
f5fc83d
Parents:
6f75d64
Message:

Merged r3043:3145 from experimental:
New Makefile code and other improvements.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CLFS2/master.sh

    r6f75d64 r045b2dc  
    1212  local   CLFS_HOST
    1313
    14   echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files${R_arrow}"
     14  echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files ( SETUP ) ${R_arrow}"
    1515
    1616  # defined here, only for ease of reading
     
    3636                touch luser-exist; \\
    3737        fi;
    38         @chown \$(LUSER) \$(MOUNT_PT) && \\
     38        @chown -R \$(LUSER) \$(MOUNT_PT) && \\
    3939        chown \$(LUSER) \$(MOUNT_PT)/sources
    4040        @touch \$@ && \\
     
    6565        echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc
    6666        @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
    67         touch envars
     67        touch envars && \\
     68        chown \$(LUSER):\$(LGROUP) envars && \\
     69        chmod -R a+wt \$(MOUNT_PT)
    6870        @touch \$@ && \\
    6971        echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
     
    123125EOF
    124126) >> $MKFILE.tmp
     127
     128  host_prep=" 023-creatingtoolsdir 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile"
    125129}
    126130
     
    129133cross_tools_Makefiles() {     #
    130134#-----------------------------#
    131   echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools${R_arrow}"
     135  echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools     ( LUSER ) ${R_arrow}"
    132136
    133137  for file in cross-tools/* ; do
     
    176180    # Drop in the name of the target on a new line, and the previous target
    177181    # as a dependency. Also call the echo_message function.
    178     wrt_target "${this_script}" "$PREV"
     182    LUSER_wrt_target "${this_script}" "$PREV"
    179183    #
    180184    # If $pkg_tarball isn't empty, we've got a package...
    181185    if [ "$pkg_tarball" != "" ] ; then
    182        wrt_unpack "$pkg_tarball"
     186       LUSER_wrt_unpack "$pkg_tarball"
    183187       # If using optimizations, write the instructions
    184188       [[ "$OPTIMIZE" != "0" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
    185189    fi
    186190    #
    187     wrt_RunAsUser "${this_script}" "${file}"
    188     #
    189     [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     191    LUSER_wrt_RunAsUser "${file}"
     192    #
     193    [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
    190194    #
    191195    # Include a touch of the target name so make can check if it's already been made.
     
    207211final_system_Makefiles() {    #
    208212#-----------------------------#
    209   echo "${tab_}${GREEN}Processing... ${L_arrow}final system${R_arrow}"
     213  echo "${tab_}${GREEN}Processing... ${L_arrow}final system    ( LUSER ) ${R_arrow}"
    210214
    211215  for file in final-system/* ; do
     
    241245    # Drop in the name of the target on a new line, and the previous target
    242246    # as a dependency. Also call the echo_message function.
    243     wrt_target "${this_script}" "$PREV"
     247    LUSER_wrt_target "${this_script}" "$PREV"
    244248    #
    245249    # If $pkg_tarball isn't empty, we've got a package...
    246250    if [ "$pkg_tarball" != "" ] ; then
    247       wrt_unpack "$pkg_tarball"
     251      LUSER_wrt_unpack "$pkg_tarball"
    248252      # If using optimizations, write the instructions
    249253      [[ "$OPTIMIZE" != "0" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
    250254    fi
    251255    #
    252     wrt_RunAsUser "${this_script}" "${file}"
    253     #
    254     [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     256    LUSER_wrt_RunAsUser "${file}"
     257    #
     258    [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
    255259    #
    256260    # Include a touch of the target name so make can check if it's already been made.
     
    271275bootscripts_Makefiles() {     #
    272276#-----------------------------#
    273     echo "${tab_}${GREEN}Processing... ${L_arrow}bootscripts${R_arrow}"
     277  echo "${tab_}${GREEN}Processing... ${L_arrow}bootscripts     ( LUSER ) ${R_arrow}"
    274278
    275279  for file in bootscripts/* ; do
     
    307311    # Drop in the name of the target on a new line, and the previous target
    308312    # as a dependency. Also call the echo_message function.
    309     wrt_target "${this_script}" "$PREV"
     313    LUSER_wrt_target "${this_script}" "$PREV"
    310314    #
    311315    # If $pkg_tarball isn't empty, we've got a package...
    312     [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
    313     #
    314     wrt_RunAsUser "${this_script}" "${file}"
    315     #
    316     [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     316    [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
     317    #
     318    LUSER_wrt_RunAsUser "${file}"
     319    #
     320    [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
    317321    #
    318322    # Include a touch of the target name so make can check if it's already been made.
     
    334338bootable_Makefiles() {        #
    335339#-----------------------------#
    336   echo "${tab_}${GREEN}Processing... ${L_arrow}make bootable${R_arrow}"
     340  echo "${tab_}${GREEN}Processing... ${L_arrow}make bootable   ( LUSER ) ${R_arrow}"
    337341
    338342  for file in bootable/* ; do
     
    343347    case $this_script in
    344348      *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* )  continue ;;
     349      *fstab)  [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
    345350      *kernel) # if there is no kernel config file do not build the kernel
    346351               [[ -z $CONFIG ]] && continue
     
    352357    # First append each name of the script files to a list (this will become
    353358    # the names of the targets in the Makefile
    354     bootable="$bootable $this_script"
     359    # NOTE: new makfile format forces the last script, *chowning, into a separate
     360    #  phase.
     361    case ${this_script} in
     362      *chowning) chowning=${this_script}   ;;
     363              *) bootable="$bootable $this_script"  ;;
     364    esac
    355365    #
    356366    # Grab the name of the target, strip id number and misc words.
     
    369379    # Drop in the name of the target on a new line, and the previous target
    370380    # as a dependency. Also call the echo_message function.
    371     wrt_target "${this_script}" "$PREV"
     381    LUSER_wrt_target "${this_script}" "$PREV"
    372382    #
    373383    # If $pkg_tarball isn't empty, we've got a package...
    374     [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
     384    [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
    375385    #
    376386    # Select a script execution method
    377387    case $this_script in
    378388      *fstab*)  if [[ -n "$FSTAB" ]]; then
    379                   wrt_copy_fstab "${this_script}"
     389                  LUSER_wrt_CopyFstab
    380390                else
    381                   wrt_RunAsUser "${this_script}" "${file}"
     391                  LUSER_wrt_RunAsUser "${file}"
    382392                fi
    383393          ;;
    384394      *chowning)  wrt_RunAsRoot "${this_script}" "${file}"
    385395          ;;
    386               *)  wrt_RunAsUser "${this_script}" "${file}"
     396              *)  LUSER_wrt_RunAsUser "${file}"
    387397          ;;
    388398    esac
    389399    #
    390400    # Housekeeping...remove any build directory(ies) except if the package build fails.
    391     [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     401    [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
    392402    #
    393403    # Include a touch of the target name so make can check if it's already been made.
     
    402412
    403413  done
    404 
    405   # Add SBU-disk_usage report target if required
    406   if [[ "$REPORT" = "y" ]] ; then wrt_report ; fi
    407414
    408415}
     
    447454LUSER_HOME = /home/\$(LUSER)
    448455
     456export PATH := \${PATH}:/usr/sbin
     457
    449458include makefile-functions
    450459
     
    455464  # as a dependency.
    456465(
    457         cat << EOF
    458 all:  chapter2 chapter3 chapter4 chapter5 chapter6 restore-luser-env do-housekeeping
     466cat << EOF
     467
     468all:    ck_UID mk_SETUP mk_LUSER mk_ROOT create-sbu_du-report
     469        @sudo make do-housekeeping
    459470        @\$(call echo_finished,$VERSION)
    460471
    461 chapter2:  023-creatingtoolsdir 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile
    462 
    463 chapter3:  chapter2 $cross_tools
    464 
    465 chapter4:  chapter3 $basicsystem
    466 
    467 chapter5:  chapter4 $bootscripttools
    468 
    469 chapter6:  chapter5 $bootable
    470 
    471 clean-all:  clean
    472         rm -rf ./{clfs2-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
    473 
    474 clean:
     472ck_UID:
     473        @if [ \`id -u\` = "0" ]; then \\
     474          echo "--------------------------------------------------"; \\
     475          echo "You cannot run this makefile from the root account"; \\
     476          echo "--------------------------------------------------"; \\
     477          exit 1; \\
     478        fi
     479
     480mk_SETUP:
     481        @\$(call echo_SU_request)
     482        @sudo make SETUP
     483        @touch \$@
     484
     485mk_LUSER: mk_SETUP
     486        @\$(call echo_SULUSER_request)
     487        @(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" )
     488        @sudo make restore-luser-env
     489        @touch \$@
     490
     491mk_ROOT:
     492        @sudo make ROOT
     493        @touch \$@
     494
     495SETUP:  $host_prep
     496
     497LUSER:  $cross_tools $basicsystem $bootscripttools $bootable
     498
     499ROOT:   $chowning
     500
    475501
    476502restart:
    477         @echo "This feature does not exist for the CLFS makefile. (yet)"
     503        @echo "This feature does not exist for the CLFS-2 makefile. (yet)"
    478504
    479505restore-luser-env:
     
    499525) >> $MKFILE
    500526
     527  # Add SBU-disk_usage report target
     528  echo "create-sbu_du-report:" >> $MKFILE
     529  if [[ "$REPORT" = "y" ]] ; then
     530(
     531    cat << EOF
     532        @\$(call echo_message, Building)
     533        @./create-sbu_du-report.sh logs $VERSION
     534        @\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report)
     535        @touch  \$@
     536
     537
     538EOF
     539) >> $MKFILE
     540  else echo -e "\t@true\n\n" >> $MKFILE; fi
     541
    501542  # Bring over the items from the Makefile.tmp
    502543  cat $MKFILE.tmp >> $MKFILE
Note: See TracChangeset for help on using the changeset viewer.