source: HLFS/master.sh@ 7e0a1b8

ablfs-more legacy trunk
Last change on this file since 7e0a1b8 was c57747d, checked in by Pierre Labastie <pierre@…>, 7 years ago

Make the date of the SBU_DU file the same as the one reported at the end of
the jhalfs run. Note that date is the one when the run is started

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