- Timestamp:
- 08/30/2006 02:01:04 AM (18 years ago)
- Branches:
- experimental
- Children:
- 08a4953
- Parents:
- 01b6d52
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LFS/master.sh
r01b6d52 r50fb011 8 8 9 9 10 #----------------------------# 11 chapter4_Makefiles() { 12 #----------------------------# 13 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4${R_arrow}" 10 ############################################################# 11 12 13 #----------------------------# 14 chapter4_Makefiles() { # 15 #----------------------------# 16 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4 ( SETUP ) ${R_arrow}" 14 17 15 18 # If /home/$LUSER is already present in the host, we asume that the … … 36 39 fi; 37 40 @chown \$(LUSER) \$(MOUNT_PT)/tools && \\ 41 chown -R \$(LUSER) \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\ 38 42 chmod a+wt \$(MOUNT_PT)/sources && \\ 39 43 touch \$@ && \\ … … 58 62 chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\ 59 63 touch envars && \\ 64 chown \$(LUSER) envars && \\ 60 65 touch \$@ && \\ 61 66 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ 62 67 echo --------------------------------------------------------------------------------\$(WHITE) 63 68 EOF 64 ) >> $MKFILE.tmp 69 ) > $MKFILE.tmp 70 71 chapter4=" 020-creatingtoolsdir 021-addinguser 022-settingenvironment" 65 72 } 66 73 74 75 67 76 #----------------------------# 68 77 chapter5_Makefiles() { 69 78 #----------------------------# 70 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5 ${R_arrow}"79 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5 ( LUSER ) ${R_arrow}" 71 80 72 81 for file in chapter05/* ; do … … 87 96 # First append each name of the script files to a list (this will become 88 97 # the names of the targets in the Makefile 89 chapter5="$chapter5 ${this_script}" 98 # DO NOT append the changingowner script. 99 # A hack is necessary: create script in chap5 BUT run as a dependency for 100 # chap6 CHROOT 101 case "${this_script}" in 102 *changingowner) : ;; 103 *) chapter5="$chapter5 ${this_script}" ;; 104 esac 90 105 91 106 # Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc … … 102 117 # Drop in the name of the target on a new line, and the previous target 103 118 # as a dependency. Also call the echo_message function. 104 wrt_target "${this_script}" "$PREV"119 LUSER_wrt_target "${this_script}" "$PREV" 105 120 106 121 # Find the version of the command files, if it corresponds with the building of … … 111 126 if [ "$pkg_tarball" != "" ] ; then 112 127 # Insert instructions for unpacking the package and to set the PKGDIR variable. 113 wrt_unpack "$pkg_tarball"128 LUSER_wrt_unpack "$pkg_tarball" 114 129 # If the testsuites must be run, initialize the log file 115 [[ "$TEST" = "3" ]] && wrt_test_log "${this_script}"130 [[ "$TEST" = "3" ]] && LUSER_wrt_test_log "${this_script}" 116 131 # If using optimizations, write the instructions 117 132 [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name" … … 123 138 case "${this_script}" in 124 139 *changingowner) wrt_RunAsRoot "${this_script}" "$file" ;; 125 *) wrt_RunAsUser "${this_script}""$file" ;;140 *) LUSER_wrt_RunAsUser "$file" ;; 126 141 esac 127 142 … … 129 144 # (so we can review config.cache, config.log, etc.) 130 145 if [ "$pkg_tarball" != "" ] ; then 131 wrt_remove_build_dirs "$name"146 LUSER_RemoveBuildDirs "$name" 132 147 fi 133 148 … … 145 160 } 146 161 162 147 163 #----------------------------# 148 164 chapter6_Makefiles() { 149 165 #----------------------------# 166 150 167 # Set envars and scripts for iteration targets 151 168 LOGS="" # Start with an empty global LOGS envar … … 167 184 fi 168 185 169 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ${R_arrow}"186 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}" 170 187 171 188 for file in chapter06$N/* ; do … … 209 226 # Drop in the name of the target on a new line, and the previous target 210 227 # as a dependency. Also call the echo_message function. 211 wrt_target "${this_script}${N}" "$PREV"228 CHROOT_wrt_target "${this_script}${N}" "$PREV" 212 229 213 230 # If $pkg_tarball isn't empty, we've got a package... 214 231 # Insert instructions for unpacking the package and changing directories 215 232 if [ "$pkg_tarball" != "" ] ; then 216 wrt_unpack2"$pkg_tarball"233 CHROOT_Unpack "$pkg_tarball" 217 234 # If the testsuites must be run, initialize the log file 218 235 case $name in 219 236 binutils | gcc | glibc ) 220 [[ "$TEST" != "0" ]] && wrt_test_log2"${this_script}"237 [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}" 221 238 ;; 222 239 * ) 223 [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && wrt_test_log2"${this_script}"240 [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && CHROOT_wrt_test_log "${this_script}" 224 241 ;; 225 242 esac … … 232 249 case "${this_script}" in 233 250 *kernfs) wrt_RunAsRoot "${this_script}" "$file" ;; 234 *) wrt_run_as_chroot1 "${this_script}""$file" ;;251 *) CHROOT_wrt_RunAsRoot "$file" ;; 235 252 esac 236 253 237 254 # Remove the build directory(ies) except if the package build fails. 238 255 if [ "$pkg_tarball" != "" ] ; then 239 wrt_remove_build_dirs "$name"256 CHROOT_wrt_RemoveBuildDirs "$name" 240 257 fi 241 258 … … 258 275 chapter789_Makefiles() { 259 276 #----------------------------# 260 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8/9 ${R_arrow}"277 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8/9 ( BOOT ) ${R_arrow}" 261 278 262 279 for file in chapter0{7,8,9}/* ; do … … 275 292 *reboot) continue ;; 276 293 *console) continue ;; # Use the file generated by lfs-bootscripts 294 *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;; 277 295 *kernel) [[ -z ${CONFIG} ]] && continue 278 296 cp ${CONFIG} $BUILDDIR/sources/kernel-config ;; … … 289 307 # Drop in the name of the target on a new line, and the previous target 290 308 # as a dependency. Also call the echo_message function. 291 wrt_target "${this_script}" "$PREV"309 CHROOT_wrt_target "${this_script}" "$PREV" 292 310 293 311 # Find the bootscripts and kernel package names … … 296 314 name="lfs-bootscripts" 297 315 pkg_tarball=$(get_package_tarball_name $name) 298 wrt_unpack2"$pkg_tarball"316 CHROOT_Unpack "$pkg_tarball" 299 317 ;; 300 318 *kernel) 301 319 name="linux" 302 320 pkg_tarball=$(get_package_tarball_name $name) 303 wrt_unpack2"$pkg_tarball"321 CHROOT_Unpack "$pkg_tarball" 304 322 ;; 305 323 esac … … 308 326 case "${this_script}" in 309 327 *fstab) if [[ -n $FSTAB ]]; then 310 wrt_copy_fstab "${this_script}"328 CHROOT_wrt_CopyFstab 311 329 else 312 wrt_run_as_chroot2 "$this_script""$file"330 CHROOT_wrt_RunAsRoot "$file" 313 331 fi 314 332 ;; 315 *) wrt_run_as_chroot2 "$this_script""$file"333 *) CHROOT_wrt_RunAsRoot "$file" 316 334 ;; 317 335 esac 318 336 319 337 case "${this_script}" in 320 *bootscripts) wrt_remove_build_dirs "dummy" ;;321 *kernel) wrt_remove_build_dirs "dummy" ;;338 *bootscripts) CHROOT_wrt_RemoveBuildDirs "dummy" ;; 339 *kernel) CHROOT_wrt_RemoveBuildDirs "dummy" ;; 322 340 esac 323 341 … … 339 357 340 358 341 #----------------------------# 342 build_Makefile() { 343 #----------------------------# 359 360 #----------------------------# 361 build_Makefile() { # 362 #----------------------------# 363 344 364 echo "Creating Makefile... ${BOLD}START${OFF}" 365 345 366 cd $JHALFSDIR/${PROGNAME}-commands 346 367 347 368 # Start with a clean Makefile.tmp file 348 >$MKFILE .tmp349 369 >$MKFILE 370 350 371 chapter4_Makefiles 351 372 chapter5_Makefiles … … 355 376 chapter789_Makefiles 356 377 357 358 378 # Add a header, some variables and include the function file 359 379 # to the top of the real Makefile. … … 361 381 cat << EOF 362 382 $HEADER 383 363 384 364 385 SRC = /sources … … 382 403 SU_LUSER = su - \$(LUSER) -c 383 404 LUSER_HOME = /home/\$(LUSER) 384 PRT_DU = echo -e "\nKB: \`du -skx --exclude= jhalfs \$(MOUNT_PT)\`\n"385 PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) \$(MOUNT_PT)\`\n"405 PRT_DU = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) \$(MOUNT_PT) \`\n" 406 PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) / \`\n" 386 407 387 408 … … 390 411 EOF 391 412 ) > $MKFILE 392 393 413 394 414 # Add chroot commands … … 415 435 ( 416 436 cat << EOF 417 all: chapter4 chapter5 chapter6 chapter789 do_housekeeping 437 438 all: mk_SETUP mk_LUSER mk_CHROOT mk_BOOT 418 439 @\$(call echo_finished,$VERSION) 419 440 420 chapter4: 020-creatingtoolsdir 021-addinguser 022-settingenvironment 421 422 chapter5: chapter4 $chapter5 restore-luser-env 423 424 chapter6: chapter5 $chapter6 425 426 chapter789: chapter6 $chapter789 441 442 mk_SETUP: 443 @\$(call echo_SU_request) 444 @sudo make SETUP 445 @touch \$@ 446 447 mk_LUSER: mk_SETUP 448 @\$(call echo_SULUSER_request) 449 @( \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" ) 450 @touch \$@ 451 # 452 # The convoluted piece of code below is necessary to provide 'make' with a valid shell in the 453 # chroot environment. (Unless someone knows a different way) 454 # Manually create the /bin directory and provide link to the /tools dir. 455 # Also change the original symlink creation to include (f)orce to prevent failure due to 456 # pre-existing links. 457 # 458 mk_CHROOT: mk_LUSER 057-changingowner 059-kernfs 459 @mkdir \$(MOUNT_PT)/bin && \\ 460 cd \$(MOUNT_PT)/bin && \\ 461 ln -sf /tools/bin/bash bash; ln -sf bash sh 462 @sed -e 's|^ln -sv|ln -svf|' -i \$(CMDSDIR)/chapter06/063-createfiles 463 @\$(call echo_CHROOT_request) 464 @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make CHROOT") 465 @touch \$@ 466 467 mk_BOOT: mk_CHROOT 468 @\$(call echo_CHROOT_request) 469 @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BOOT") 470 @touch \$@ 471 472 473 SETUP: $chapter4 474 475 LUSER: $chapter5 476 477 CHROOT: $chapter6 478 479 BOOT: $chapter789 480 481 427 482 428 483 clean-all: clean … … 526 581 fi; 527 582 583 584 528 585 EOF 529 586 ) >> $MKFILE 587 588 530 589 531 590 # Bring over the items from the Makefile.tmp … … 533 592 rm $MKFILE.tmp 534 593 echo "Creating Makefile... ${BOLD}DONE${OFF}" 535 536 594 } 537 595
Note:
See TracChangeset
for help on using the changeset viewer.