Changeset 45f82718


Ignore:
Timestamp:
04/29/2006 02:44:29 PM (18 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
1.0, 2.3, 2.3.x, 2.4, ablfs, ablfs-more, legacy, new_features, trunk
Children:
0ad851d
Parents:
c7c5a53
Message:

Merged ICA/farce support from experimental branch.

Files:
6 added
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • CLFS/master.sh

    rc7c5a53 r45f82718  
    462462final_system_Makefiles() {    #
    463463#-----------------------------#
    464   echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system${R_arrow}"
    465 
    466   for file in final-system/* ; do
     464  # Set envars and scripts for iteration targets
     465  LOGS="" # Start with an empty global LOGS envar
     466  if [[ -z "$1" ]] ; then
     467    local N=""
     468  else
     469    local N=-build_$1
     470    local basicsystem=""
     471    mkdir final-system$N
     472    cp final-system/* final-system$N
     473    for script in final-system$N/* ; do
     474      # Overwrite existing symlinks, files, and dirs
     475      sed -e 's/ln -sv/&f/g' \
     476          -e 's/mv -v/&f/g' \
     477          -e 's/mkdir -v/&p/g' -i ${script}
     478    done
     479    # Remove Bzip2 binaries before make install
     480    sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2
     481    # Fix how Module-Init-Tools do the install target
     482    sed -e 's@make install@make INSTALL=install install@' -i final-system$N/*-module-init-tools
     483    # Delete *old Readline libraries just after make install
     484    sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline
     485  fi
     486
     487  echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system$N${R_arrow}"
     488
     489  for file in final-system$N/* ; do
    467490    # Keep the script file name
    468491    this_script=`basename $file`
    469492
    470     # Test if the stripping phase must be skipped
    471     case $this_script in
    472       *stripping*) [[ "$STRIP" = "0" ]] && continue
    473        ;;
    474     esac
    475 
    476     # First append each name of the script files to a list (this will become
    477     # the names of the targets in the Makefile
    478     basicsystem="$basicsystem $this_script"
     493    # Test if the stripping phase must be skipped.
     494    # Skip alsp temp-perl for iterative runs
     495    case $this_script in
     496      *stripping*) [[ "$STRIP" = "0" ]] && continue ;;
     497      *temp-perl*) [[ -n "$N" ]] && continue ;;
     498    esac
    479499
    480500    # Grab the name of the target, strip id number, XXX-script
     
    486506                                  -e 's@n32@@'`
    487507
     508    # Find the version of the command files, if it corresponds with the building of
     509    # a specific package. We need this here to can skip scripts not needed for
     510    # iterations rebuilds
    488511    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
     512
     513    if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
     514      case "${this_script}" in
     515        *stripping*) ;;
     516        *)  continue ;;
     517      esac
     518    fi
     519
     520    # Append each name of the script files to a list (this will become
     521    # the names of the targets in the Makefile
     522    basicsystem="$basicsystem ${this_script}${N}"
     523
     524    # Append each name of the script files to a list (this will become
     525    # the names of the logs to be moved for each iteration)
     526    LOGS="$LOGS ${this_script}"
    489527
    490528    #--------------------------------------------------------------------#
     
    494532    # Drop in the name of the target on a new line, and the previous target
    495533    # as a dependency. Also call the echo_message function.
    496     wrt_target "${this_script}" "$PREV"
     534    wrt_target "${this_script}${N}" "$PREV"
    497535
    498536    # If $vrs isn't empty, we've got a package...
    499537    if [ "$vrs" != "" ] ; then
    500       case $name in
    501         temp-perl) wrt_unpack2 "perl-$vrs.tar.*"    ;;
    502         *)         wrt_unpack2 "$name-$vrs.tar.*"   ;;
    503       esac
     538      FILE="$name-$vrs.tar.*"
     539      wrt_unpack2 "$FILE"
    504540    fi
    505541    #
     
    516552    #
    517553    # Keep the script file name for Makefile dependencies.
    518     PREV=$this_script
    519 
     554    PREV=${this_script}${N}
     555    # Set system_build envar for iteration targets
     556    system_build=$basicsystem
    520557  done  # for file in final-system/* ...
    521558}
     
    525562bm_final_system_Makefiles() { #
    526563#-----------------------------#
    527   echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system${R_arrow}"
    528 
    529   # The makesys phase was initiated in bm_testsuite_tools_makefile
    530   [[ "$TEST" = 0 ]] && PREV=""
    531 
    532   for file in final-system/* ; do
     564  # Set envars and scripts for iteration targets
     565  LOGS="" # Start with an empty global LOGS envar
     566  if [[ -z "$1" ]] ; then
     567    local N=""
     568    # The makesys phase was initiated in bm_testsuite_tools_makefile
     569    [[ "$TEST" = 0 ]] && PREV=""
     570  else
     571    local N=-build_$1
     572    local basicsystem=""
     573    mkdir final-system$N
     574    cp final-system/* final-system$N
     575    for script in final-system$N/* ; do
     576      # Overwrite existing symlinks, files, and dirs
     577      sed -e 's/ln -sv/&f/g' \
     578          -e 's/mv -v/&f/g' \
     579          -e 's/mkdir -v/&p/g' -i ${script}
     580    done
     581    # Remove Bzip2 binaries before make install
     582    sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2
     583    # Fix how Module-Init-Tools do the install target
     584    sed -e 's@make install@make INSTALL=install install@' -i final-system$N/*-module-init-tools
     585    # Delete *old Readline libraries just after make install
     586    sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline
     587  fi
     588
     589  echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system$N${R_arrow}"
     590
     591  for file in final-system$N/* ; do
    533592    # Keep the script file name
    534593    this_script=`basename $file`
    535594
    536595    # Test if the stripping phase must be skipped
    537     case $this_script in
    538       *stripping*) [[ "$STRIP" = "0" ]] && continue
    539        ;;
    540     esac
    541 
    542     # First append each name of the script files to a list (this will become
    543     # the names of the targets in the Makefile
    544     basicsystem="$basicsystem $this_script"
     596    # Skip alsp temp-perl for iterative runs
     597    case $this_script in
     598      *stripping*) [[ "$STRIP" = "0" ]] && continue ;;
     599      *temp-perl*) [[ -n "$N" ]] && continue ;;
     600    esac
    545601
    546602    # Grab the name of the target, strip id number, XXX-script
     
    552608                                  -e 's@n32@@'`
    553609
     610    # Find the version of the command files, if it corresponds with the building of
     611    # a specific package. We need this here to can skip scripts not needed for
     612    # iterations rebuilds
    554613    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
     614
     615    if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
     616      case "${this_script}" in
     617        *stripping*) ;;
     618        *)  continue ;;
     619      esac
     620    fi
     621
     622    # Append each name of the script files to a list (this will become
     623    # the names of the targets in the Makefile
     624    basicsystem="$basicsystem ${this_script}${N}"
     625
     626    # Append each name of the script files to a list (this will become
     627    # the names of the logs to be moved for each iteration)
     628    LOGS="$LOGS ${this_script}"
    555629
    556630    #--------------------------------------------------------------------#
     
    560634    # Drop in the name of the target on a new line, and the previous target
    561635    # as a dependency. Also call the echo_message function.
    562     wrt_target "${this_script}" "$PREV"
     636    wrt_target "${this_script}${N}" "$PREV"
    563637
    564638    # If $vrs isn't empty, we've got a package...
    565639    if [ "$vrs" != "" ] ; then
    566       case $name in
    567         temp-perl) wrt_unpack3 "perl-$vrs.tar.*"    ;;
    568         *)         wrt_unpack3 "$name-$vrs.tar.*"   ;;
    569       esac
     640      FILE="$name-$vrs.tar.*"
     641      wrt_unpack3 "$FILE"
    570642    fi
    571643    #
     
    582654    #
    583655    # Keep the script file name for Makefile dependencies.
    584     PREV=$this_script
    585 
     656    PREV=${this_script}${N}
     657    # Set system_build envar for iteration targets
     658    system_build=$basicsystem
    586659  done  # for file in final-system/* ...
    587660}
     
    886959    fi
    887960    final_system_Makefiles         # $basicsystem
     961    # Add the iterations targets, if needed
     962    [[ "$COMPARE" != "0" ]] && wrt_compare_targets
    888963    bootscripts_Makefiles          # $bootscripttools
    889964    bootable_Makefiles             # $bootabletools
     
    894969    fi
    895970    bm_final_system_Makefiles      # $basicsystem
     971    # Add the iterations targets, if needed
     972    [[ "$COMPARE" != "0" ]] && wrt_compare_targets
    896973    bm_bootscripts_Makefiles       # $bootscipttools
    897974    bm_bootable_Makefiles          # $bootabletoosl
  • HLFS/master.sh

    rc7c5a53 r45f82718  
    296296  local file
    297297  local this_script
    298 
    299   echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6${R_arrow}"
     298  # Set envars and scripts for iteration targets
     299  LOGS="" # Start with an empty global LOGS envar
     300  if [[ -z "$1" ]] ; then
     301    local N=""
     302  else
     303    local N=-build_$1
     304    local chapter6=""
     305    mkdir chapter06$N
     306    cp chapter06/* chapter06$N
     307    for script in chapter06$N/* ; do
     308      # Overwrite existing symlinks, files, and dirs
     309      sed -e 's/ln -s /ln -sf /g' \
     310          -e 's/^mv /&-f/g' -i ${script}
     311    done
     312    # Remove Bzip2 binaries before make install
     313    sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2
     314    # Fix how Module-Init-Tools do the install target
     315    sed -e 's@make install@make INSTALL=install install@' -i chapter06$N/*-module-init-tools
     316    # Delete *old Readline libraries just after make install
     317    sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i chapter06$N/*-readline
     318    # Don't readd already existing groups
     319    sed -e '/groupadd/d' -i chapter06$N/*-udev
     320  fi
     321
     322  echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N${R_arrow}"
    300323  #
    301324  # Set these definitions early and only once
     
    307330  fi
    308331
    309   for file in chapter06/* ; do
     332  for file in chapter06$N/* ; do
    310333    # Keep the script file name
    311334    this_script=`basename $file`
     
    318341        # Test if the stripping phase must be skipped
    319342      *-stripping* )  [[ "$STRIP" = "0" ]] && continue ;;
    320       *) ;;
    321     esac
    322 
    323     # First append each name of the script files to a list (this will become
    324     # the names of the targets in the Makefile
    325     chapter6="$chapter6 $this_script"
     343    esac
    326344
    327345    # Grab the name of the target
    328346    name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
    329 
    330     #
    331     # Sed replacement to fix some rm command that could fail.
    332     # That should be fixed in the book sources.
    333     #
    334     case $name in
    335       glibc)
    336           sed 's/rm /rm -f /' -i chapter06/$this_script
    337         ;;
    338       gcc)
    339           sed 's/rm /rm -f /' -i chapter06/$this_script
    340         ;;
    341     esac
    342 
    343     #--------------------------------------------------------------------#
    344     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
    345     #--------------------------------------------------------------------#
    346     #
    347     # Drop in the name of the target on a new line, and the previous target
    348     # as a dependency. Also call the echo_message function.
    349     wrt_target "$this_script" "$PREV"
    350347
    351348    # Find the version of the command files, if it corresponds with the building of
    352349    # a specific package
    353350    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
     351
     352    if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
     353      case "${this_script}" in
     354        *stripping*) ;;
     355        *)  continue ;;
     356      esac
     357    fi
     358
     359    # Append each name of the script files to a list (this will become
     360    # the names of the targets in the Makefile
     361    chapter6="$chapter6 ${this_script}${N}"
     362
     363    # Append each name of the script files to a list (this will become
     364    # the names of the logs to be moved for each iteration)
     365    LOGS="$LOGS ${this_script}"
     366
     367    #
     368    # Sed replacement to fix some rm command that could fail.
     369    # That should be fixed in the book sources.
     370    #
     371    case $name in
     372      glibc)
     373          sed 's/rm /rm -f /' -i chapter06$N/$this_script
     374        ;;
     375      gcc)
     376          sed 's/rm /rm -f /' -i chapter06$N/$this_script
     377        ;;
     378    esac
     379
     380    #--------------------------------------------------------------------#
     381    #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
     382    #--------------------------------------------------------------------#
     383    #
     384    # Drop in the name of the target on a new line, and the previous target
     385    # as a dependency. Also call the echo_message function.
     386    wrt_target "${this_script}${N}" "$PREV"
    354387
    355388    # If $vrs isn't empty, we've got a package...
     
    409442
    410443    # Keep the script file name for Makefile dependencies.
    411     PREV=$this_script
     444    PREV=${this_script}${N}
     445    # Set system_build envar for iteration targets
     446    system_build=$chapter6
    412447  done # end for file in chapter06/*
    413448
     
    519554  chapter5_Makefiles
    520555  chapter6_Makefiles
     556  # Add the iterations targets, if needed
     557  [[ "$COMPARE" != "0" ]] && wrt_compare_targets
    521558  chapter7_Makefiles
    522559
  • LFS/master.sh

    rc7c5a53 r45f82718  
    145145chapter6_Makefiles() {
    146146#----------------------------#
    147   echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6${R_arrow}"
    148 
    149   for file in chapter06/* ; do
     147  # Set envars and scripts for iteration targets
     148  LOGS="" # Start with an empty global LOGS envar
     149  if [[ -z "$1" ]] ; then
     150    local N=""
     151  else
     152    local N=-build_$1
     153    local chapter6=""
     154    mkdir chapter06$N
     155    cp chapter06/* chapter06$N
     156    for script in chapter06$N/* ; do
     157      # Overwrite existing symlinks, files, and dirs
     158      sed -e 's/ln -sv/&f/g' \
     159          -e 's/mv -v/&f/g' \
     160          -e 's/mkdir -v/&p/g' -i ${script}
     161    done
     162    # Remove Bzip2 binaries before make install
     163    sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2
     164    # Fix how Module-Init-Tools do the install target
     165    sed -e 's@make install@make INSTALL=install install@' -i chapter06$N/*-module-init-tools
     166    # Delete *old Readline libraries just after make install
     167    sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i chapter06$N/*-readline
     168    # Let some Udev pre-installation commands to fail
     169    sed -e 's@/lib/udev/devices/fd@& || true@' \
     170        -e 's/mknod -m.*/& || true/' -i chapter06$N/*-udev
     171  fi
     172
     173  echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N${R_arrow}"
     174
     175  for file in chapter06$N/* ; do
    150176    # Keep the script file name
    151177    this_script=`basename $file`
     
    158184    esac
    159185
    160     # First append each name of the script files to a list (this will become
    161     # the names of the targets in the Makefile
    162     chapter6="$chapter6 ${this_script}"
    163 
    164186    # Grab the name of the target
    165187    name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@'`
    166188
     189    # Find the version of the command files, if it corresponds with the building of
     190    # a specific package. We need this here to can skip scripts not needed for
     191    # iterations rebuilds
     192    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
     193
     194    if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
     195      case "${this_script}" in
     196        *stripping*) ;;
     197        *)  continue ;;
     198      esac
     199    fi
     200
     201    # Append each name of the script files to a list (this will become
     202    # the names of the targets in the Makefile)
     203    chapter6="$chapter6 ${this_script}${N}"
     204
     205    # Append each name of the script files to a list (this will become
     206    # the names of the logs to be moved for each iteration)
     207    LOGS="$LOGS ${this_script}"
     208
    167209    #--------------------------------------------------------------------#
    168210    #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
     
    171213    # Drop in the name of the target on a new line, and the previous target
    172214    # as a dependency. Also call the echo_message function.
    173     wrt_target "${this_script}" "$PREV"
    174 
    175     # Find the version of the command files, if it corresponds with the building of
    176     # a specific package
    177     vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
     215    wrt_target "${this_script}${N}" "$PREV"
    178216
    179217    # If $vrs isn't empty, we've got a package...
     
    205243
    206244    # Keep the script file name for Makefile dependencies.
    207     PREV=${this_script}
     245    PREV=${this_script}${N}
     246    # Set system_build envar for iteration targets
     247    system_build=$chapter6
    208248  done # end for file in chapter06/*
    209249}
     
    305345  chapter5_Makefiles
    306346  chapter6_Makefiles
     347  # Add the iterations targets, if needed
     348  [[ "$COMPARE" != "0" ]] && wrt_compare_targets
    307349  chapter789_Makefiles
    308350
  • common/common-functions

    rc7c5a53 r45f82718  
    7676[[ ${PROGNAME} != "blfs" ]] &&
    7777cat <<- -EOF-
     78
     79${BOLD}  -C, --comparasion TYPE${OFF}
     80         do iterative comparison analysis. That will take several time due that
     81         the final system packages wil be rebuilded the times defined in the
     82         ITERATIONS config option.
     83         Analisys types allowed are:
     84           ICA   = do the ICA analisys designed by Greg Schafer
     85           farce = do the farce analisys designed by Ken Moffat
     86           both  = perfom both ICA and farce analisys
    7887
    7988${BOLD}  -F, --fstab FILE${OFF}
  • common/config

    rc7c5a53 r45f82718  
    6363KEYMAP=none
    6464
    65 #=== Variables needed by ICA (Not implemented yet :-/)===
    66 #--- Run ICA testing 0/1  0(no)/1(yes)
     65#=== Variables needed by iterative comparison analysis ===
     66#--- Should some iterative comparison analysis by made? 0(no)/1(yes)
     67COMPARE=0
     68
     69#--- The number of final stage builds to create and compare, min. 2, max. 5
     70ITERATIONS=3
     71
     72#--- Run ICA testing 0(no)/1(yes)
    6773RUN_ICA=0
    6874
    69 #--- The number of final stage builds to create and compare
    70 ITERATIONS=
    71 
    72 #--- ICA report log directory
    73 ICALOGDIR=$JHALFSDIR/logs/ICA
     75#--- Run farce testing 0(no)/1(yes)
     76RUN_FARCE=0
    7477
    7578#==== INTERNAL VARIABLES ====
     
    7982JHALFSDIR=$BUILDDIR/jhalfs
    8083   LOGDIR=$JHALFSDIR/logs
     84
     85#--- ICA report log directory
     86ICALOGDIR=$LOGDIR/ICA
     87
     88#--- farce report log directory
     89FARCELOGDIR=$LOGDIR/farce
  • common/func_validate_configs.sh

    rc7c5a53 r45f82718  
    11# $Id$
    22
    3 validate_target() {
    4 
     3#----------------------------#
     4validate_target() {          #
     5#----------------------------#
    56  local -r ERROR_MSG_pt1='The variable \"${L_arrow}TARGET${R_arrow}\" value ${L_arrow}${BOLD}${TARGET}${R_arrow} is invalid for the ${L_arrow}${BOLD}${ARCH}${R_arrow} architecture'
    67  local -r ERROR_MSG_pt2='  check the config file ${BOLD}${GREEN}\<$(echo $PROGNAME | tr [a-z] [A-Z])/config\> or \<common/config\>${OFF}'
     
    6869
    6970#----------------------------#
    70 validate_config()    {       # Are the config values sane (within reason)
     71validate_config() {          # Are the config values sane (within reason)
    7172#----------------------------#
    7273: <<inline_doc
     
    7980    modifies:   none
    8081    returns:    nothing
    81     on error:   write text to console and dies
     82    on error:   write text to console and dies
    8283    on success: write text to console and returns
    8384inline_doc
     
    8586  # First internal variables, then the ones that change the book's flavour, and lastly system configuration variables
    8687  local -r blfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG         DEPEND                TEST"
    87   local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE MODEL GRSECURITY_HOST TEST REPORT STRIP FSTAB             CONFIG KEYMAP         PAGE TIMEZONE LANG LC_ALL"
    88   local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE METHOD  ARCH  TARGET  TEST REPORT STRIP FSTAB BOOT_CONFIG CONFIG KEYMAP VIMLANG PAGE TIMEZONE LANG"
    89   local -r  lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE                       TEST REPORT STRIP FSTAB             CONFIG        VIMLANG PAGE TIMEZONE LANG"
     88  local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE MODEL GRSECURITY_HOST TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG KEYMAP         PAGE TIMEZONE LANG LC_ALL"
     89  local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE METHOD  ARCH  TARGET  TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG KEYMAP VIMLANG PAGE TIMEZONE LANG"
     90  local -r  lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE                       TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG        VIMLANG PAGE TIMEZONE LANG"
    9091
    9192  local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,'
     
    9495
    9596  local    PARAM_LIST=
    96 
    9797  local config_param
    9898  local validation_str
     99  local save_param
    99100
    100101  write_error_and_die() {
     
    106107  }
    107108
    108   validate_str() {
     109  validate_against_str() {
    109110     # This is the 'regexp' test available in bash-3.0..
    110111     # using it as a poor man's test for substring
    111112     echo -e "`eval echo $PARAM_VALS`"
    112      if [[ ! "${validation_str}" =~ "x${!config_param}x" ]] ; then
     113     if [[ ! "$1" =~ "x${!config_param}x" ]] ; then
    113114       # parameter value entered is no good
    114115       write_error_and_die
     
    116117  }
    117118
     119  validate_file() {
     120     # For parameters ending with a '+' failure causes a warning message only
     121     echo -n "`eval echo $PARAM_VALS`"
     122     while test $# -gt 0 ; do
     123       case $1 in
     124        # Failures caused program exit
     125        "-z")  [[   -z "${!config_param}" ]] && echo "${tab_}<-- NO file name given"  && write_error_and_die ;;
     126        "-e")  [[ ! -e "${!config_param}" ]] && echo "${tab_}<-- file does not exist" && write_error_and_die ;;
     127        "-s")  [[ ! -s "${!config_param}" ]] && echo "${tab_}<-- file has zero bytes" && write_error_and_die ;;
     128        "-r")  [[ ! -r "${!config_param}" ]] && echo "${tab_}<-- no read permission " && write_error_and_die ;;
     129        "-w")  [[ ! -w "${!config_param}" ]] && echo "${tab_}<-- no write permission" && write_error_and_die ;;
     130        "-x")  [[ ! -x "${!config_param}" ]] && echo "${tab_}<-- file cannot be executed" && write_error_and_die ;;
     131        # Warning messages only
     132        "-z+") [[   -z "${!config_param}" ]] && echo && return ;;
     133       esac
     134       shift 1
     135     done
     136     echo
     137  }
     138
     139  validate_dir() {
     140     # For parameters ending with a '+' failure causes a warning message only
     141     echo -n "`eval echo $PARAM_VALS`"
     142     while test $# -gt 0 ; do
     143       case $1 in
     144        "-z") [[   -z "${!config_param}" ]] && echo "${tab_}NO directory name given" && write_error_and_die ;;
     145        "-d") [[ ! -d "${!config_param}" ]] && echo "${tab_}This is NOT a directory" && write_error_and_die ;;
     146        "-w") if [[ ! -w "${!config_param}" ]]; then
     147                echo "${nl_}${DD_BORDER}"
     148                echo "${tab_}${RED}You do not have ${L_arrow}write${R_arrow}${RED} access to the directory${OFF}"
     149                echo "${tab_}${BOLD}${!config_param}${OFF}"
     150                echo "${DD_BORDER}${nl_}"
     151                exit 1
     152              fi  ;;
     153        # Warnings only
     154        "-w+") if [[ ! -w "${!config_param}" ]]; then
     155                 echo "${nl_}${DD_BORDER}"
     156                 echo "${tab_}WARNING-- You do not have ${L_arrow}write${R_arrow} access to the directory${OFF}"
     157                 echo "${tab_}       -- ${BOLD}${!config_param}${OFF}"
     158                 echo "${DD_BORDER}"
     159               fi  ;;
     160        "-z+") [[ -z "${!config_param}" ]] && echo "${tab_}<-- NO directory name given" && return
     161       esac
     162       shift 1
     163     done
     164     echo
     165  }
     166
    118167  set +e
    119   for PARAM_GROUP in ${PROGNAME}_PARAM_LIST; do
    120     for config_param in ${!PARAM_GROUP}; do
    121       # This is a tricky little piece of code.. executes a cmd string.
    122       case $config_param in
    123         BUILDDIR) # We cannot have an <empty> or </> root mount point
    124             echo -e "`eval echo $PARAM_VALS`"
    125             if [[ "xx x/x" =~ "x${!config_param}x" ]]; then
    126               write_error_and_die
    127             fi
    128             continue  ;;
    129         TIMEZONE)  continue;;
    130         MKFILE)    continue;;
    131         HPKG)      validation_str="x0x x1x";          validate_str; continue ;;
    132         RUNMAKE)   validation_str="x0x x1x";          validate_str; continue ;;
    133         TEST)      validation_str="x0x x1x x2x x3x";  validate_str; continue ;;
    134         REPORT)    validation_str="x0x x1x";          validate_str;
    135             if [[ "${!config_param}" = "1" ]]; then
    136               if [[ `type -p bc` ]]; then
    137                 continue
    138               else
    139                 echo -e "  ${BOLD}The bc binary was not found${OFF}"
    140                 echo -e "  The SBU and disk usage report creation will be skiped"
    141                 REPORT=0
    142                 continue
    143               fi
    144             fi ;;
    145         STRIP)     validation_str="x0x x1x";          validate_str; continue ;;
    146         VIMLANG)   validation_str="x0x x1x";          validate_str; continue ;;
    147         DEPEND)    validation_str="x0x x1x x2x";      validate_str; continue ;;
    148         MODEL)     validation_str="xglibcx xuclibcx"; validate_str; continue ;;
    149         PAGE)      validation_str="xletterx xA4x";    validate_str; continue ;;
    150         GRSECURITY_HOST)  validation_str="x0x x1x";   validate_str; continue ;;
    151         METHOD)    validation_str="xchrootx xbootx";  validate_str; continue ;;
    152         ARCH)      validation_str="xx86x xx86_64x xx86_64-64x xsparcx xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xppc64x xalphax";  validate_str; continue ;;
    153         TARGET)    validate_target; continue ;;
    154       esac
    155 
    156 
    157       if [[ "${config_param}" = "LC_ALL" ]]; then
    158          echo "`eval echo $PARAM_VALS`"
    159          [[ -z "${!config_param}" ]] && echo -e "\nVariable LC_ALL cannot be empty!" && write_error_and_die
    160           # See it the locale values exist on this machine
    161          if [[ "`locale -a | grep -c ${!config_param}`" > 0 ]]; then
    162            continue
    163          else  # If you make it this far then there is a problem
    164            write_error_and_die
    165          fi
    166       fi
    167 
    168       if [[ "${config_param}" = "LANG" ]]; then
    169          echo "`eval echo $PARAM_VALS`"
    170          [[ -z "${!config_param}" ]] && echo -e "\nVariable LANG cannot be empty!" && write_error_and_die
    171           # See if the locale values exist on this machine
    172          if [[ "`locale -a | grep -c ${!config_param}`" > 0 ]]; then
    173            continue
    174          else  # If you make it this far then there is a problem
    175            write_error_and_die
    176          fi
    177       fi
    178 
    179 
    180       if [[ "${config_param}"  = "KEYMAP" ]]; then
    181          echo "`eval echo $PARAM_VALS`"
    182          [[ "${!config_param}" = "none" ]] && continue
    183          if [[ -e "/usr/share/kbd/keymaps/${!config_param}" ]] &&
    184             [[ -s "/usr/share/kbd/keymaps/${!config_param}" ]]; then
    185             continue
    186          else
    187             write_error_and_die
    188          fi
    189       fi
    190 
    191       if [[ "${config_param}" = "SRC_ARCHIVE" ]]; then
    192          echo -n "`eval echo $PARAM_VALS`"
    193          if [ ! -z ${SRC_ARCHIVE} ]; then
    194            if [ ! -d ${SRC_ARCHIVE} ]; then
    195              echo "   -- is NOT a directory"
    196              write_error_and_die
    197            fi
    198            if [ ! -w ${SRC_ARCHIVE} ]; then
    199              echo -n "${nl_} [${BOLD}${YELLOW}WARN$OFF] You do not have <write> access to this directory, ${nl_}${tab_}downloaded files can not be saved in this archive"
    200            fi
    201         fi
    202         echo
    203         continue
    204       fi
    205 
    206       if [[ "${config_param}" = "FSTAB" ]]; then
    207          echo "`eval echo $PARAM_VALS`"
    208          [[ -z "${!config_param}" ]] && continue
    209          if [[ -e "${!config_param}" ]] &&
    210             [[ -s "${!config_param}" ]]; then
    211            continue
    212          else
    213            write_error_and_die
    214          fi
    215       fi
    216 
    217       if [[ "${config_param}" = "BOOK" ]]; then
    218          echo "`eval echo $PARAM_VALS`"
    219          [[ ! "${WC}" = 1 ]] && continue
    220          [[ -z "${!config_param}" ]] && continue
    221          if [[ -e "${!config_param}" ]] &&
    222             [[ -s "${!config_param}" ]]; then
    223            continue
    224          else
    225            write_error_and_die
    226          fi
    227       fi
    228 
    229       if [[ "${config_param}" = "CONFIG" ]]; then
    230          echo "`eval echo $PARAM_VALS`"
    231          [[ -z "${!config_param}" ]] && continue
    232          if [[ -e "${!config_param}" ]] &&
    233             [[ -s "${!config_param}" ]]; then
    234            continue
    235          else
    236            write_error_and_die
    237          fi
    238       fi
    239 
    240       if [[ "${config_param}" = "BOOT_CONFIG" ]]; then
    241         if [[ "${METHOD}" = "boot" ]]; then
    242             echo "`eval echo $PARAM_VALS`"
    243            # There must be a config file when the build method is 'boot'
    244            [[ -e "${!config_param}" ]] && [[ -s "${!config_param}" ]] && continue
    245            # If you make it this far then there is a problem
    246           write_error_and_die
    247         fi
    248       fi
    249     done
     168  PARAM_GROUP=${PROGNAME}_PARAM_LIST
     169  for config_param in ${!PARAM_GROUP}; do
     170    # This is a tricky little piece of code.. executes a cmd string.
     171    case $config_param in
     172      BUILDDIR) # We cannot have an <empty> or </> root mount point
     173                  echo -e "`eval echo $PARAM_VALS`"
     174                  [[ "xx x/x" =~ "x${!config_param}x" ]] &&
     175                       write_error_and_die
     176                  ;;
     177      TIMEZONE)   ;;
     178
     179      # Validate general parameters..
     180      HPKG)       validate_against_str "x0x x1x" ;;
     181      RUNMAKE)    validate_against_str "x0x x1x" ;;
     182      REPORT)     validate_against_str "x0x x1x"
     183                  if [[ "${!config_param}" = "1" ]]; then
     184                    if [[ `type -p bc` ]]; then
     185                      continue
     186                    else
     187                      echo -e "  ${BOLD}The bc binary was not found${OFF}"
     188                      echo -e "  The SBU and disk usage report creation will be skiped"
     189                      REPORT=0
     190                      continue
     191                    fi
     192                  fi ;;
     193      COMPARE)    if [[ ! "$COMPARE" = "1" ]]; then
     194                    validate_against_str "x0x x1x"
     195                  else
     196                    if [[ ! "${RUN_ICA}" = "1" ]] && [[ ! "${RUN_FARCE}" = "1" ]]; then
     197                       echo  "${nl_}${DD_BORDER}"
     198                       echo  "You have elected to analyse your build but have failed to select a tool." >&2
     199                       echo  "Edit /common/config and set ${L_arrow}${BOLD}RUN_ICA${R_arrow} and/or ${L_arrow}${BOLD}RUN_FARCE${R_arrow} to the required values" >&2
     200                       echo  "${DD_BORDER}${nl_}"
     201                       exit 1
     202                    fi
     203                  fi ;;
     204      RUN_ICA)    [[ "$COMPARE" = "1" ]] && validate_against_str "x0x x1x" ;;
     205      RUN_FARCE)  [[ "$COMPARE" = "1" ]] && validate_against_str "x0x x1x" ;;
     206      ITERATIONS) [[ "$COMPARE" = "1" ]] && validate_against_str "x2x x3x x4x x5x" ;;
     207      TEST)       validate_against_str "x0x x1x x2x x3x" ;;
     208      STRIP)      validate_against_str "x0x x1x" ;;
     209      VIMLANG)    validate_against_str "x0x x1x" ;;
     210      DEPEND)     validate_against_str "x0x x1x x2x" ;;
     211      MODEL)      validate_against_str "xglibcx xuclibcx" ;;
     212      PAGE)       validate_against_str "xletterx xA4x" ;;
     213      METHOD)     validate_against_str "xchrootx xbootx" ;;
     214      ARCH)       validate_against_str "xx86x xx86_64x xx86_64-64x xsparcx xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xppc64x xalphax" ;;
     215      TARGET)     validate_target ;;
     216      GRSECURITY_HOST)  validate_against_str "x0x x1x" ;;
     217
     218      # BOOK validation. Very ugly, need be fixed
     219      BOOK)        if [[ "${WC}" = "1" ]] ; then
     220                     validate_dir -z -d
     221                   else
     222                     validate_against_str "x${PROGNAME}-developmentx xlfs-udev_updatex"
     223                   fi
     224                   ;;
     225
     226      # Validate directories, testable states:
     227      #  fatal   -z -d -w,
     228      #  warning -z+   -w+
     229      SRC_ARCHIVE) validate_dir -z+ -d -w+ ;;
     230
     231      # Validate files, testable states:
     232      #  fatal   -z -e -s -w -x -r,
     233      #  warning -z+
     234      FSTAB)       validate_file -z+ -e -s ;;
     235      CONFIG)      validate_file -z+ -e -s ;;
     236      BOOT_CONFIG) [[ "${METHOD}" = "boot" ]] && validate_file -z -e -s ;;
     237
     238      # Treatment of 'special' parameters
     239      LANG | \
     240      LC_ALL)  # See it the locale values exist on this machine
     241               echo -n "`eval echo $PARAM_VALS`"
     242               [[ -z "${!config_param}" ]] &&
     243                 echo " -- Variable $config_param cannot be empty!" &&
     244                 write_error_and_die
     245               [[ ! "`locale -a | grep -c ${!config_param}`" > 0 ]] &&
     246                  write_error_and_die
     247               echo
     248               ;;
     249      KEYMAP)  echo "`eval echo $PARAM_VALS`"
     250               save_param=${KEYMAP}
     251               [[ ! "${!config_param}" = "none" ]] &&
     252                  KEYMAP="/usr/share/kbd/keymaps/${KEYMAP}" &&
     253                  validate_file -z -e -s
     254               KEYMAP=${save_param}
     255               ;;
     256    esac
    250257  done
    251 
    252258  set -e
    253259  echo "$tab_***${BOLD}${GREEN} ${PARAM_GROUP%%_*T} config parameters look good${OFF} ***"
  • master.sh

    rc7c5a53 r45f82718  
    5252[[ $VERBOSITY > 0 ]] && echo "OK"
    5353#
    54 
    5554[[ $VERBOSITY > 0 ]] && echo -n "Loading masterscript conf..."
    5655source $COMMON_DIR/config
    5756[[ $? > 0 ]] && echo "$COMMON_DIR/conf did not load.." && exit
     57[[ $VERBOSITY > 0 ]] && echo "OK"
     58#
     59[[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..."
     60source $COMMON_DIR/func_compare.sh
     61[[ $? > 0 ]] && echo "$COMMON_DIR/func_compare.sh did not load.." && exit
    5862[[ $VERBOSITY > 0 ]] && echo "OK"
    5963#
     
    9397
    9498###################################
    95 ###             MAIN            ###
     99###          MAIN               ###
    96100###################################
    97101
     
    214218
    215219    # Common options for LFS, CLFS and HLFS
     220    --comparasion | -C )
     221      test $# = 1 && eval "$exit_missing_arg"
     222      shift
     223      case $1 in
     224        ICA)              RUN_ICA=1
     225                        RUN_FARCE=0
     226                          COMPARE=1
     227        ;;
     228        farce)            RUN_ICA=0
     229                        RUN_FARCE=1
     230                          COMPARE=1
     231        ;;
     232        both)             RUN_ICA=1
     233                        RUN_FARCE=1
     234                          COMPARE=1
     235        ;;
     236        *)
     237          echo -e "\n$1 is an unknown analisys method."
     238          exit 1
     239          ;;
     240      esac
     241      ;;
     242
    216243    --fstab | -F )
    217244      test $# = 1 && eval "$exit_missing_arg"
     
    455482if [[ "$PWD" != "$JHALFSDIR" ]]; then
    456483  cp $COMMON_DIR/makefile-functions $JHALFSDIR/
     484  if [[ "$COMPARE" != "0" ]] ; then
     485    mkdir -p $JHALFSDIR/extras
     486    cp extras/* $JHALFSDIR/extras
     487  fi
    457488  if [[ -n "$FILES" ]]; then
    458489    # pushd/popd necessary to deal with mulitiple files
Note: See TracChangeset for help on using the changeset viewer.