Changeset 45f82718
- Timestamp:
- 04/29/2006 02:44:29 PM (18 years ago)
- Branches:
- 1.0, 2.3, 2.3.x, 2.4, ablfs, ablfs-more, legacy, new_features, trunk
- Children:
- 0ad851d
- Parents:
- c7c5a53
- Files:
-
- 6 added
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
CLFS/master.sh
rc7c5a53 r45f82718 462 462 final_system_Makefiles() { # 463 463 #-----------------------------# 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 467 490 # Keep the script file name 468 491 this_script=`basename $file` 469 492 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 479 499 480 500 # Grab the name of the target, strip id number, XXX-script … … 486 506 -e 's@n32@@'` 487 507 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 488 511 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}" 489 527 490 528 #--------------------------------------------------------------------# … … 494 532 # Drop in the name of the target on a new line, and the previous target 495 533 # as a dependency. Also call the echo_message function. 496 wrt_target "${this_script} " "$PREV"534 wrt_target "${this_script}${N}" "$PREV" 497 535 498 536 # If $vrs isn't empty, we've got a package... 499 537 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" 504 540 fi 505 541 # … … 516 552 # 517 553 # 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 520 557 done # for file in final-system/* ... 521 558 } … … 525 562 bm_final_system_Makefiles() { # 526 563 #-----------------------------# 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 533 592 # Keep the script file name 534 593 this_script=`basename $file` 535 594 536 595 # 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 545 601 546 602 # Grab the name of the target, strip id number, XXX-script … … 552 608 -e 's@n32@@'` 553 609 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 554 613 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}" 555 629 556 630 #--------------------------------------------------------------------# … … 560 634 # Drop in the name of the target on a new line, and the previous target 561 635 # as a dependency. Also call the echo_message function. 562 wrt_target "${this_script} " "$PREV"636 wrt_target "${this_script}${N}" "$PREV" 563 637 564 638 # If $vrs isn't empty, we've got a package... 565 639 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" 570 642 fi 571 643 # … … 582 654 # 583 655 # 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 586 659 done # for file in final-system/* ... 587 660 } … … 886 959 fi 887 960 final_system_Makefiles # $basicsystem 961 # Add the iterations targets, if needed 962 [[ "$COMPARE" != "0" ]] && wrt_compare_targets 888 963 bootscripts_Makefiles # $bootscripttools 889 964 bootable_Makefiles # $bootabletools … … 894 969 fi 895 970 bm_final_system_Makefiles # $basicsystem 971 # Add the iterations targets, if needed 972 [[ "$COMPARE" != "0" ]] && wrt_compare_targets 896 973 bm_bootscripts_Makefiles # $bootscipttools 897 974 bm_bootable_Makefiles # $bootabletoosl -
HLFS/master.sh
rc7c5a53 r45f82718 296 296 local file 297 297 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}" 300 323 # 301 324 # Set these definitions early and only once … … 307 330 fi 308 331 309 for file in chapter06 /* ; do332 for file in chapter06$N/* ; do 310 333 # Keep the script file name 311 334 this_script=`basename $file` … … 318 341 # Test if the stripping phase must be skipped 319 342 *-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 326 344 327 345 # Grab the name of the target 328 346 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 in335 glibc)336 sed 's/rm /rm -f /' -i chapter06/$this_script337 ;;338 gcc)339 sed 's/rm /rm -f /' -i chapter06/$this_script340 ;;341 esac342 343 #--------------------------------------------------------------------#344 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #345 #--------------------------------------------------------------------#346 #347 # Drop in the name of the target on a new line, and the previous target348 # as a dependency. Also call the echo_message function.349 wrt_target "$this_script" "$PREV"350 347 351 348 # Find the version of the command files, if it corresponds with the building of 352 349 # a specific package 353 350 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" 354 387 355 388 # If $vrs isn't empty, we've got a package... … … 409 442 410 443 # 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 412 447 done # end for file in chapter06/* 413 448 … … 519 554 chapter5_Makefiles 520 555 chapter6_Makefiles 556 # Add the iterations targets, if needed 557 [[ "$COMPARE" != "0" ]] && wrt_compare_targets 521 558 chapter7_Makefiles 522 559 -
LFS/master.sh
rc7c5a53 r45f82718 145 145 chapter6_Makefiles() { 146 146 #----------------------------# 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 150 176 # Keep the script file name 151 177 this_script=`basename $file` … … 158 184 esac 159 185 160 # First append each name of the script files to a list (this will become161 # the names of the targets in the Makefile162 chapter6="$chapter6 ${this_script}"163 164 186 # Grab the name of the target 165 187 name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@'` 166 188 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 167 209 #--------------------------------------------------------------------# 168 210 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # … … 171 213 # Drop in the name of the target on a new line, and the previous target 172 214 # 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" 178 216 179 217 # If $vrs isn't empty, we've got a package... … … 205 243 206 244 # 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 208 248 done # end for file in chapter06/* 209 249 } … … 305 345 chapter5_Makefiles 306 346 chapter6_Makefiles 347 # Add the iterations targets, if needed 348 [[ "$COMPARE" != "0" ]] && wrt_compare_targets 307 349 chapter789_Makefiles 308 350 -
common/common-functions
rc7c5a53 r45f82718 76 76 [[ ${PROGNAME} != "blfs" ]] && 77 77 cat <<- -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 78 87 79 88 ${BOLD} -F, --fstab FILE${OFF} -
common/config
rc7c5a53 r45f82718 63 63 KEYMAP=none 64 64 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) 67 COMPARE=0 68 69 #--- The number of final stage builds to create and compare, min. 2, max. 5 70 ITERATIONS=3 71 72 #--- Run ICA testing 0(no)/1(yes) 67 73 RUN_ICA=0 68 74 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) 76 RUN_FARCE=0 74 77 75 78 #==== INTERNAL VARIABLES ==== … … 79 82 JHALFSDIR=$BUILDDIR/jhalfs 80 83 LOGDIR=$JHALFSDIR/logs 84 85 #--- ICA report log directory 86 ICALOGDIR=$LOGDIR/ICA 87 88 #--- farce report log directory 89 FARCELOGDIR=$LOGDIR/farce -
common/func_validate_configs.sh
rc7c5a53 r45f82718 1 1 # $Id$ 2 2 3 validate_target() { 4 3 #----------------------------# 4 validate_target() { # 5 #----------------------------# 5 6 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' 6 7 local -r ERROR_MSG_pt2=' check the config file ${BOLD}${GREEN}\<$(echo $PROGNAME | tr [a-z] [A-Z])/config\> or \<common/config\>${OFF}' … … 68 69 69 70 #----------------------------# 70 validate_config() {# Are the config values sane (within reason)71 validate_config() { # Are the config values sane (within reason) 71 72 #----------------------------# 72 73 : <<inline_doc … … 79 80 modifies: none 80 81 returns: nothing 81 on error: 82 on error: write text to console and dies 82 83 on success: write text to console and returns 83 84 inline_doc … … 85 86 # First internal variables, then the ones that change the book's flavour, and lastly system configuration variables 86 87 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" 90 91 91 92 local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,' … … 94 95 95 96 local PARAM_LIST= 96 97 97 local config_param 98 98 local validation_str 99 local save_param 99 100 100 101 write_error_and_die() { … … 106 107 } 107 108 108 validate_ str() {109 validate_against_str() { 109 110 # This is the 'regexp' test available in bash-3.0.. 110 111 # using it as a poor man's test for substring 111 112 echo -e "`eval echo $PARAM_VALS`" 112 if [[ ! "$ {validation_str}" =~ "x${!config_param}x" ]] ; then113 if [[ ! "$1" =~ "x${!config_param}x" ]] ; then 113 114 # parameter value entered is no good 114 115 write_error_and_die … … 116 117 } 117 118 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 118 167 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 250 257 done 251 252 258 set -e 253 259 echo "$tab_***${BOLD}${GREEN} ${PARAM_GROUP%%_*T} config parameters look good${OFF} ***" -
master.sh
rc7c5a53 r45f82718 52 52 [[ $VERBOSITY > 0 ]] && echo "OK" 53 53 # 54 55 54 [[ $VERBOSITY > 0 ]] && echo -n "Loading masterscript conf..." 56 55 source $COMMON_DIR/config 57 56 [[ $? > 0 ]] && echo "$COMMON_DIR/conf did not load.." && exit 57 [[ $VERBOSITY > 0 ]] && echo "OK" 58 # 59 [[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..." 60 source $COMMON_DIR/func_compare.sh 61 [[ $? > 0 ]] && echo "$COMMON_DIR/func_compare.sh did not load.." && exit 58 62 [[ $VERBOSITY > 0 ]] && echo "OK" 59 63 # … … 93 97 94 98 ################################### 95 ### MAIN###99 ### MAIN ### 96 100 ################################### 97 101 … … 214 218 215 219 # 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 216 243 --fstab | -F ) 217 244 test $# = 1 && eval "$exit_missing_arg" … … 455 482 if [[ "$PWD" != "$JHALFSDIR" ]]; then 456 483 cp $COMMON_DIR/makefile-functions $JHALFSDIR/ 484 if [[ "$COMPARE" != "0" ]] ; then 485 mkdir -p $JHALFSDIR/extras 486 cp extras/* $JHALFSDIR/extras 487 fi 457 488 if [[ -n "$FILES" ]]; then 458 489 # pushd/popd necessary to deal with mulitiple files
Note:
See TracChangeset
for help on using the changeset viewer.