source: HLFS/master.sh@ 267b19d

ablfs-more legacy trunk
Last change on this file since 267b19d was fd4a798, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Remove $Id$ comments, they are useless with git

  • Property mode set to 100644
File size: 21.1 KB
Line 
1#!/bin/bash
2set -e # Enable error trapping
3
4###################################
5### FUNCTIONS ###
6###################################
7
8
9#----------------------------#
10process_toolchain() { # embryo,cocoon and butterfly need special handling
11#----------------------------#
12 local toolchain=$1
13 local this_file=$2
14 local tc_phase
15 local binutil_tarball
16 local gcc_core_tarball
17 local TC_MountPT
18 local remove_existing
19
20 tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@' -e 's,'$N',,'`
21 case $tc_phase in
22 embryo | \
23 cocoon) # Vars for LUSER phase
24 remove_existing="remove_existing_dirs"
25 TC_MountPT="\$(MOUNT_PT)\$(SRC)"
26 ;;
27 butterfly) # Vars for CHROOT phase
28 remove_existing="remove_existing_dirs2"
29 TC_MountPT="\$(SRC)"
30 ;;
31 esac
32
33 #
34 # Safe method to remove existing toolchain dirs
35 binutil_tarball=$(get_package_tarball_name "binutils")
36 gcc_core_tarball=$(get_package_tarball_name "gcc-core")
37(
38cat << EOF
39 @\$(call ${remove_existing},$binutil_tarball)
40 @\$(call ${remove_existing},$gcc_core_tarball)
41EOF
42) >> $MKFILE.tmp
43
44 #
45 # Manually remove the toolchain directories..
46(
47cat << EOF
48 @rm -rf ${TC_MountPT}/${tc_phase}-toolchain && \\
49 rm -rf ${TC_MountPT}/${tc_phase}-build
50EOF
51) >> $MKFILE.tmp
52
53
54(
55cat << EOF
56 @echo "export PKGDIR=${TC_MountPT}" > envars
57EOF
58) >> $MKFILE.tmp
59
60 case ${tc_phase} in
61 butterfly)
62 [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${toolchain}"
63 CHROOT_wrt_RunAsRoot "$this_file"
64 ;;
65 *) LUSER_wrt_RunAsUser "$this_file"
66 ;;
67 esac
68 #
69(
70cat << EOF
71 @\$(call ${remove_existing},$binutil_tarball)
72 @\$(call ${remove_existing},$gcc_core_tarball)
73EOF
74) >> $MKFILE.tmp
75
76 #
77 # Manually remove the toolchain directories..
78(
79cat << EOF
80 @rm -rf ${TC_MountPT}/${tc_phase}-toolchain && \\
81 rm -rf ${TC_MountPT}/${tc_phase}-build
82EOF
83) >> $MKFILE.tmp
84
85}
86
87
88#----------------------------#
89chapter3_Makefiles() { # Initialization of the system
90#----------------------------#
91
92 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter3 ( SETUP ) ${R_arrow}"
93
94 # If $LUSER_HOME is already present in the host, we asume that the
95 # hlfs user and group are also presents in the host, and a backup
96 # of their bash init files is made.
97(
98cat << EOF
99020-creatingtoolsdir:
100 @\$(call echo_message, Building)
101 @mkdir \$(MOUNT_PT)/tools && \\
102 rm -f /tools && \\
103 ln -s \$(MOUNT_PT)/tools /
104 @\$(call housekeeping)
105
106021-addinguser: 020-creatingtoolsdir
107 @\$(call echo_message, Building)
108 @if [ ! -d \$(LUSER_HOME) ]; then \\
109 groupadd \$(LGROUP); \\
110 useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
111 else \\
112 touch luser-exist; \\
113 fi;
114 @chown \$(LUSER) \$(MOUNT_PT)/tools && \\
115 chmod -R a+wt \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
116 chmod a+wt \$(SRCSDIR)
117 @\$(call housekeeping)
118
119022-settingenvironment: 021-addinguser
120 @\$(call echo_message, Building)
121 @if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
122 mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
123 fi;
124 @if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
125 mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
126 fi;
127 @echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
128 echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
129 echo "HLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
130 echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
131 echo "PATH=/tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
132 echo "export HLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
133 echo "" >> \$(LUSER_HOME)/.bashrc && \\
134 echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc && \\
135 chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
136 chmod -R a+wt \$(MOUNT_PT) && \\
137 touch envars && \\
138 chown \$(LUSER) envars
139 @\$(call housekeeping)
140EOF
141) >> $MKFILE.tmp
142 chapter3=" 020-creatingtoolsdir 021-addinguser 022-settingenvironment"
143}
144
145#----------------------------#
146chapter5_Makefiles() { # Bootstrap or temptools phase
147#----------------------------#
148 local file
149 local this_script
150
151 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5 ( LUSER ) ${R_arrow}"
152
153 for file in chapter05/* ; do
154 # Keep the script file name
155 this_script=`basename $file`
156
157 # Skip this script depending on jhalfs.conf flags set.
158 case $this_script in
159 # If no testsuites will be run, then TCL, Expect and DejaGNU aren't needed
160 *tcl* ) [[ "$TEST" = "0" ]] && continue; ;;
161 *expect* ) [[ "$TEST" = "0" ]] && continue; ;;
162 *dejagnu* ) [[ "$TEST" = "0" ]] && continue; ;;
163 # Test if the stripping phase must be skipped
164 *stripping* ) [[ "$STRIP" = "n" ]] && continue ;;
165 *) ;;
166 esac
167
168 # First append each name of the script files to a list (this will become
169 # the names of the targets in the Makefile
170 chapter5="$chapter5 $this_script"
171
172 # Grab the name of the target
173 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'`
174
175 # Adjust 'name'
176 case $name in
177 uclibc) name="uClibc" ;;
178 esac
179
180 # Set the dependency for the first target.
181 if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
182
183 #--------------------------------------------------------------------#
184 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
185 #--------------------------------------------------------------------#
186 #
187 # Drop in the name of the target on a new line, and the previous target
188 # as a dependency. Also call the echo_message function.
189
190 # This is a very special script and requires manual processing
191 # NO Optimization allowed
192 if [[ ${name} = "embryo-toolchain" ]] || \
193 [[ ${name} = "cocoon-toolchain" ]]; then
194 LUSER_wrt_target "$this_script" "$PREV"
195 process_toolchain "${this_script}" "${file}"
196 wrt_touch
197 PREV=$this_script
198 continue
199 fi
200 #
201 LUSER_wrt_target "$this_script" "$PREV"
202 # Find the version of the command files, if it corresponds with the building of
203 # a specific package. Fix GCC tarball name for 2.4-branch.
204 case $name in
205 gcc ) pkg_tarball=$(get_package_tarball_name gcc-core) ;;
206 * ) pkg_tarball=$(get_package_tarball_name $name) ;;
207 esac
208 # If $pkg_tarball isn't empty, we've got a package...
209 if [ "$pkg_tarball" != "" ] ; then
210 # Insert instructions for unpacking the package and to set the PKGDIR variable.
211 LUSER_wrt_unpack "$pkg_tarball"
212 # If using optimizations, write the instructions
213 [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
214 fi
215 # Insert date and disk usage at the top of the log file, the script run
216 # and date and disk usage again at the bottom of the log file.
217 LUSER_wrt_RunAsUser "${file}"
218
219 # Remove the build directory(ies) except if the package build fails
220 # (so we can review config.cache, config.log, etc.)
221 if [ "$pkg_tarball" != "" ] ; then
222 LUSER_RemoveBuildDirs "$name"
223 fi
224
225 # Include a touch of the target name so make can check if it's already been made.
226 wrt_touch
227 #
228 #--------------------------------------------------------------------#
229 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
230 #--------------------------------------------------------------------#
231
232 # Keep the script file name for Makefile dependencies.
233 PREV=$this_script
234 done # end for file in chapter05/*
235}
236
237
238#----------------------------#
239chapter6_Makefiles() { # sysroot or chroot build phase
240#----------------------------#
241 local file
242 local this_script
243 # Set envars and scripts for iteration targets
244 if [[ -z "$1" ]] ; then
245 local N=""
246 else
247 local N=-build_$1
248 local chapter6=""
249 mkdir chapter06$N
250 cp chapter06/* chapter06$N
251 for script in chapter06$N/* ; do
252 # Overwrite existing symlinks, files, and dirs
253 sed -e 's/ln -s /ln -sf /g' \
254 -e 's/^mv /&-f /g' \
255 -e 's/mkdir -v/&p/g' -i ${script}
256 # Rename the scripts
257 mv ${script} ${script}$N
258 done
259 # Remove Bzip2 binaries before make install
260 sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2$N
261 # Fix how Module-Init-Tools do the install target
262 sed -e 's@make install@make INSTALL=install install@' -i chapter06$N/*-module-init-tools$N
263 # Don't readd already existing groups
264 sed -e '/groupadd/d' -i chapter06$N/*-udev$N
265 fi
266
267 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}"
268
269 for file in chapter06$N/* ; do
270 # Keep the script file name
271 this_script=`basename $file`
272
273 # Skip this script depending on jhalfs.conf flags set.
274 case $this_script in
275 # We'll run the chroot commands differently than the others, so skip them in the
276 # dependencies and target creation.
277 *chroot* ) continue ;;
278 # Test if the stripping phase must be skipped
279 *-stripping* ) [[ "$STRIP" = "n" ]] && continue ;;
280 # Skip linux-headers in iterative builds
281 *linux-headers*) [[ -n "$N" ]] && continue ;;
282 esac
283
284 # Grab the name of the target
285 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's,'$N',,'`
286
287 case $name in
288 uclibc) name="uClibc" ;;
289 esac
290
291 # Find the version of the command files, if it corresponds with the building of
292 # a specific package. Fix GCC tarball name for 2.4-branch.
293 case $name in
294 gcc ) pkg_tarball=$(get_package_tarball_name gcc-core) ;;
295 * ) pkg_tarball=$(get_package_tarball_name $name) ;;
296 esac
297
298 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
299 case "${this_script}" in
300 *stripping*) ;;
301 *) continue ;;
302 esac
303 fi
304
305 # Append each name of the script files to a list (this will become
306 # the names of the targets in the Makefile
307 case "${this_script}" in
308 *kernfs* ) runasroot=" ${this_script}" ;;
309 * ) chapter6="$chapter6 ${this_script}" ;;
310 esac
311
312
313 #--------------------------------------------------------------------#
314 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
315 #--------------------------------------------------------------------#
316 #
317 # Drop in the name of the target on a new line, and the previous target
318 # as a dependency. Also call the echo_message function.
319 if [[ ${name} = "butterfly-toolchain" ]]; then
320 CHROOT_wrt_target "${this_script}" "$PREV"
321 # Touch timestamp file if installed files logs will be created.
322 # But only for the firt build when running iterative builds.
323 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
324 CHROOT_wrt_TouchTimestamp
325 fi
326 process_toolchain "${this_script}" "${file}"
327 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
328 CHROOT_wrt_LogNewFiles "$name"
329 fi
330 wrt_touch
331 PREV=$this_script
332 continue
333 fi
334 # kernfs is run in SUDO target
335 case "${this_script}" in
336 *kernfs* ) LUSER_wrt_target "${this_script}" "$PREV" ;;
337 * ) CHROOT_wrt_target "${this_script}" "$PREV" ;;
338 esac
339
340 # If $pkg_tarball isn't empty, we've got a package...
341 # Insert instructions for unpacking the package and changing directories
342 if [ "$pkg_tarball" != "" ] ; then
343 # Touch timestamp file if installed files logs will be created.
344 # But only for the firt build when running iterative builds.
345 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
346 CHROOT_wrt_TouchTimestamp
347 fi
348 CHROOT_Unpack "$pkg_tarball"
349 # If the testsuites must be run, initialize the log file
350 # butterfly-toolchain tests are enabled in 'process_tookchain' function
351 # 2.4-branch toolchain is ernabled here.
352 case $name in
353 glibc | gcc | binutils)
354 [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}" ;;
355 * ) [[ "$TEST" > "1" ]] && CHROOT_wrt_test_log "${this_script}" ;;
356 esac
357 # If using optimizations, write the instructions
358 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
359 fi
360
361 # In kernfs we need to set HLFS and not to use chroot.
362 case "${this_script}" in
363 *kernfs* ) wrt_RunAsRoot "${file}" ;;
364 * ) CHROOT_wrt_RunAsRoot "${file}" ;;
365 esac
366 #
367 # Write installed files log and remove the build directory(ies)
368 # except if the package build fails.
369 if [ "$pkg_tarball" != "" ] ; then
370 CHROOT_wrt_RemoveBuildDirs "$name"
371 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
372 CHROOT_wrt_LogNewFiles "$name"
373 fi
374 fi
375 #
376 # Include a touch of the target name so make can check if it's already been made.
377 wrt_touch
378 #
379 #--------------------------------------------------------------------#
380 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
381 #--------------------------------------------------------------------#
382
383 # Keep the script file name for Makefile dependencies.
384 PREV=${this_script}
385 # Set system_build envar for iteration targets
386 system_build=$chapter6
387 done # end for file in chapter06/*
388
389}
390
391#----------------------------#
392chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..etc
393#----------------------------#
394 local file
395 local this_script
396
397 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7 ( BOOT ) ${R_arrow}"
398 for file in chapter07/*; do
399 # Keep the script file name
400 this_script=`basename $file`
401
402 case $this_script in
403 *grub) continue ;; # Grub must be configured manually.
404 *console) continue ;; # Use the file generated by lfs-bootscripts
405 *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab
406 ;;
407 *kernel) # If no .config file is supplied, the kernel build is skipped
408 [[ -z $CONFIG ]] && continue
409 cp $CONFIG $BUILDDIR/sources/kernel-config
410 ;;
411 esac
412
413 # First append then name of the script file to a list (this will become
414 # the names of the targets in the Makefile
415 chapter7="$chapter7 $this_script"
416
417 #--------------------------------------------------------------------#
418 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
419 #--------------------------------------------------------------------#
420 #
421 # Drop in the name of the target on a new line, and the previous target
422 # as a dependency. Also call the echo_message function.
423 CHROOT_wrt_target "$this_script" "$PREV"
424
425 case "${this_script}" in
426 *bootscripts*)
427 if [ "${INSTALL_LOG}" = "y" ] ; then
428 CHROOT_wrt_TouchTimestamp
429 fi
430 CHROOT_Unpack $(get_package_tarball_name "lfs-bootscripts")
431 blfs_bootscripts=$(get_package_tarball_name "blfs-bootscripts" | sed -e 's/.tar.*//' )
432 echo -e "\t@echo \"\$(MOUNT_PT)\$(SRC)/$blfs_bootscripts\" >> sources-dir" >> $MKFILE.tmp
433 ;;
434 *kernel)
435 name="linux"
436 pkg_tarball=$(get_package_tarball_name $name)
437 if [ "${INSTALL_LOG}" = "y" ] ; then
438 CHROOT_wrt_TouchTimestamp
439 fi
440 CHROOT_Unpack "$pkg_tarball"
441 ;;
442 esac
443
444 case "${this_script}" in
445 *fstab*) # Check if we have a real /etc/fstab file
446 if [[ -n "$FSTAB" ]] ; then
447 CHROOT_wrt_CopyFstab
448 else
449 CHROOT_wrt_RunAsRoot "$file"
450 fi
451 ;;
452 *) # All other scripts
453 CHROOT_wrt_RunAsRoot "${file}"
454 ;;
455 esac
456
457 # Remove the build directory except if the package build fails.
458 case "${this_script}" in
459 *bootscripts*)
460(
461cat << EOF
462 @ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
463 rm -r \$(SRC)/\$\$ROOT
464 @rm -rf \`cat sources-dir\` && \\
465 rm sources-dir
466EOF
467) >> $MKFILE.tmp
468 if [ "${INSTALL_LOG}" = "y" ] ; then
469 CHROOT_wrt_LogNewFiles "$name"
470 fi
471 ;;
472 *kernel) CHROOT_wrt_RemoveBuildDirs "dummy"
473 if [ "${INSTALL_LOG}" = "y" ] ; then
474 CHROOT_wrt_LogNewFiles "$name"
475 fi ;;
476 esac
477
478 # Include a touch of the target name so make can check if it's already been made.
479 wrt_touch
480 #
481 #--------------------------------------------------------------------#
482 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
483 #--------------------------------------------------------------------#
484
485 # Keep the script file name for Makefile dependencies.
486 PREV=$this_script
487 done # for file in chapter07/*
488}
489
490
491#----------------------------#
492build_Makefile() { # Construct a Makefile from the book scripts
493#----------------------------#
494 echo "Creating Makefile... ${BOLD}START${OFF}"
495
496 cd $JHALFSDIR/${PROGNAME}-commands
497 # Start with a clean Makefile.tmp file
498 >$MKFILE.tmp
499
500 chapter3_Makefiles
501 chapter5_Makefiles
502 chapter6_Makefiles
503 # Add the iterations targets, if needed
504 [[ "$COMPARE" = "y" ]] && wrt_compare_targets
505 chapter7_Makefiles
506 # Add the CUSTOM_TOOLS targets, if needed
507 [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
508 # Add the BLFS_TOOL targets, if needed
509 [[ "$BLFS_TOOL" = "y" ]] && wrt_blfs_tool_targets
510
511 # Add a header, some variables and include the function file
512 # to the top of the real Makefile.
513 wrt_Makefile_header
514
515 # Add chroot commands
516 CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
517 i=1
518 for file in chapter06/*chroot* ; do
519 chroot=`cat $file | \
520 sed -e "s@chroot@$CHROOT_LOC@" \
521 -e '/#!\/bin\/bash/d' \
522 -e '/^export/d' \
523 -e '/^logout/d' \
524 -e 's@ \\\@ @g' | \
525 tr -d '\n' | \
526 sed -e 's/ */ /g' \
527 -e 's|\\$|&&|g' \
528 -e 's|exit||g' \
529 -e 's|$| -c|' \
530 -e 's|"$$HLFS"|$(MOUNT_PT)|'\
531 -e 's|set -e||' \
532 -e 's|set +h||'`
533 echo -e "CHROOT$i= $chroot\n" >> $MKFILE
534 i=`expr $i + 1`
535 done
536
537 # Drop in the main target 'all:' and the chapter targets with each sub-target
538 # as a dependency.
539(
540 cat << EOF
541
542all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL
543 @sudo make do-housekeeping
544 @echo "$VERSION - jhalfs build" > hlfs-release && \\
545 sudo install -m444 hlfs-release \$(MOUNT_PT)/etc/hlfs-release
546 @\$(call echo_finished,$VERSION)
547
548ck_UID:
549 @if [ \`id -u\` = "0" ]; then \\
550 echo "--------------------------------------------------"; \\
551 echo "You cannot run this makefile from the root account"; \\
552 echo "--------------------------------------------------"; \\
553 exit 1; \\
554 fi
555
556mk_SETUP:
557 @\$(call echo_SU_request)
558 @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
559 @touch \$@
560
561mk_LUSER: mk_SETUP
562 @\$(call echo_SULUSER_request)
563 @(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) LUSER" )
564 @sudo make restore-luser-env
565 @touch \$@
566
567mk_SUDO: mk_LUSER
568 @sudo make SUDO
569 @touch \$@
570
571mk_CHROOT: mk_SUDO
572 @if [ ! -e \$(MOUNT_PT)/dev ]; then \\
573 mkdir \$(MOUNT_PT)/dev && \\
574 sudo mknod -m 666 \$(MOUNT_PT)/dev/null c 1 3 && \\
575 sudo mknod -m 600 \$(MOUNT_PT)/dev/console c 5 1 && \\
576 sudo chown -R 0:0 \$(MOUNT_PT)/dev; \\
577 fi;
578 @\$(call echo_CHROOT_request)
579 @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT")
580 @touch \$@
581
582mk_BOOT: mk_CHROOT
583 @\$(call echo_CHROOT_request)
584 @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BOOT")
585 @touch \$@
586
587mk_CUSTOM_TOOLS: create-sbu_du-report
588 @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
589 \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
590 sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
591 (sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
592 fi;
593 @touch \$@
594
595mk_BLFS_TOOL: mk_CUSTOM_TOOLS
596 @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
597 \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
598 sudo mkdir -p $BUILDDIR$TRACKING_DIR; \\
599 (sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BLFS_TOOL"); \\
600 fi;
601 @touch \$@
602
603
604SETUP: $chapter3
605LUSER: $chapter5
606SUDO: $runasroot
607CHROOT: SHELL=/tools/bin/bash
608CHROOT: $chapter6
609BOOT: $chapter7
610CUSTOM_TOOLS: $custom_list
611BLFS_TOOL: $blfs_tool
612
613
614create-sbu_du-report: mk_BOOT
615 @\$(call echo_message, Building)
616 @if [ "\$(ADD_REPORT)" = "y" ]; then \\
617 ./create-sbu_du-report.sh logs $VERSION $(date --iso-8601); \\
618 \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
619 fi;
620 @touch \$@
621
622restore-luser-env:
623 @\$(call echo_message, Building)
624 @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
625 mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
626 fi;
627 @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
628 mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
629 fi;
630 @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
631 touch \$@ && \\
632 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
633 echo --------------------------------------------------------------------------------\$(WHITE)
634
635do-housekeeping:
636 @-umount \$(MOUNT_PT)/dev/pts
637 @-umount \$(MOUNT_PT)/dev/shm
638 @-umount \$(MOUNT_PT)/dev
639 @-umount \$(MOUNT_PT)/sys
640 @-umount \$(MOUNT_PT)/proc
641 @-rm /tools
642 @-if [ ! -f luser-exist ]; then \\
643 userdel \$(LUSER); \\
644 rm -rf \$(LUSER_HOME); \\
645 fi;
646
647
648
649EOF
650) >> $MKFILE
651
652 # Bring over the items from the Makefile.tmp
653 cat $MKFILE.tmp >> $MKFILE
654 rm $MKFILE.tmp
655 echo "Creating Makefile... ${BOLD}DONE${OFF}"
656
657}
Note: See TracBrowser for help on using the repository browser.