source: HLFS/master.sh@ 31eb678

2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 31eb678 was 513b259, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Skipped several unuseful book commands via nodump.

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