source: CLFS/master.sh@ 1f25a75

2.4 ablfs-more legacy new_features trunk
Last change on this file since 1f25a75 was f0de954, checked in by Pierre Labastie <pierre@…>, 10 years ago

CLFS puts fstab in config and not anymore in bootable.
Thanks to Chris Staub for the report.

  • Property mode set to 100644
File size: 43.1 KB
Line 
1#!/bin/bash
2# $Id$
3
4
5orphan_scripts="" # 2 scripts do not fit BOOT_Makefiles LUSER environment
6
7
8#--------------------------------------#
9host_prep_Makefiles() { #
10#--------------------------------------#
11 local CLFS_HOST
12
13 echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files ( SETUP ) ${R_arrow}"
14
15 # defined here, only for ease of reading
16 CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
17(
18cat << EOF
19023-creatingtoolsdir:
20 @\$(call echo_message, Building)
21 @install -dv \$(MOUNT_PT)/tools && \\
22 rm -f /tools && \\
23 ln -s \$(MOUNT_PT)/tools /
24 @\$(call housekeeping)
25
26024-creatingcrossdir: 023-creatingtoolsdir
27 @\$(call echo_message, Building)
28 @install -dv \$(MOUNT_PT)/cross-tools && \\
29 rm -f /cross-tools && \\
30 ln -s \$(MOUNT_PT)/cross-tools /
31 @\$(call housekeeping)
32
33025-addinguser: 024-creatingcrossdir
34 @\$(call echo_message, Building)
35 @if [ ! -d \$(LUSER_HOME) ]; then \\
36 groupadd \$(LGROUP); \\
37 useradd -s /bin/bash -g \$(LGROUP) -d \$(LUSER_HOME) \$(LUSER); \\
38 mkdir -pv \$(LUSER_HOME); \\
39 chown -v \$(LUSER):\$(LGROUP) \$(LUSER_HOME); \\
40 else \\
41 touch luser-exist; \\
42 fi
43 @chown -v \$(LUSER) \$(MOUNT_PT)/tools && \\
44 chown -v \$(LUSER) \$(MOUNT_PT)/cross-tools && \\
45 chmod -R a+wt \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
46 chmod a+wt \$(SRCSDIR)
47 @\$(call housekeeping)
48
49026-settingenvironment: 025-addinguser
50 @\$(call echo_message, Building)
51 @if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
52 mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
53 fi
54 @if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
55 mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
56 fi;
57 @echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
58 echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
59 echo "CLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
60 echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
61 echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
62 echo "export CLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
63 echo "" >> \$(LUSER_HOME)/.bashrc && \\
64 echo "unset CFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
65 echo "unset CXXFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
66 echo "" >> \$(LUSER_HOME)/.bashrc && \\
67EOF
68) >> $MKFILE.tmp
69if ! [ -e final-preps/*variables ]; then
70 (
71 cat << EOF
72 echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> \$(LUSER_HOME)/.bashrc && \\
73 echo "export CLFS_TARGET=\"${TARGET}\"" >> \$(LUSER_HOME)/.bashrc && \\
74 echo "export CLFS_TARGET32=\"${TARGET32}\"" >> \$(LUSER_HOME)/.bashrc && \\
75EOF
76 ) >> $MKFILE.tmp
77fi
78(
79cat << EOF
80 echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc
81 @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
82 chmod a+wt \$(MOUNT_PT) && \\
83 if [ -d \$(MOUNT_PT)/var ]; then \\
84 chown -R \$(LUSER) \$(MOUNT_PT)/var; \\
85 fi && \\
86 touch envars && \\
87 chown \$(LUSER):\$(LGROUP) envars
88 @\$(call housekeeping)
89EOF
90) >> $MKFILE.tmp
91 host_prep=" 023-creatingtoolsdir 024-creatingcrossdir 026-settingenvironment"
92
93}
94
95#--------------------------------------#
96final_preps_Makefiles() {
97#--------------------------------------#
98 echo "${tab_}${GREEN}Processing... ${L_arrow}variables ( LUSER ) ${R_arrow}"
99 for file in final-preps/* ; do
100 this_script=`basename $file`
101 case $this_script in
102 *variables )
103 ;;
104 *) continue; ;;
105 esac
106 # Set the dependency for the first target.
107 if [ -z $PREV ] ; then PREV=026-settingenvironment ; fi
108
109 # First append each name of the script files to a list (this will become
110 # the names of the targets in the Makefile
111 final_preps="$final_preps $this_script"
112
113 # No need to grab the package name
114
115 LUSER_wrt_target "${this_script}" "$PREV"
116 LUSER_wrt_RunAsUser "${file}"
117 wrt_touch
118 PREV=$this_script
119 done # for file in ....
120}
121
122#--------------------------------------#
123cross_tools_Makefiles() { #
124#--------------------------------------#
125 echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools ( LUSER ) ${R_arrow}"
126
127 for file in cross-tools/* ; do
128 # Keep the script file name
129 this_script=`basename $file`
130 #
131 # Skip this script...
132 case $this_script in
133 *cflags* | *variables* ) # work done in host_prep_Makefiles
134 continue; ;;
135 *) ;;
136 esac
137 #
138 # Set the dependency for the first target.
139 if [ -z $PREV ] ; then PREV=026-settingenvironment ; fi
140
141 # First append each name of the script files to a list (this will become
142 # the names of the targets in the Makefile
143 cross_tools="$cross_tools $this_script"
144
145 # Grab the name of the target (minus the -headers or -cross in the case of gcc
146 # and binutils in chapter 5)
147 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
148 -e 's@-static@@' \
149 -e 's@-final@@' \
150 -e 's@-64@@' \
151 -e 's@-n32@@'`
152 pkg_tarball=$(get_package_tarball_name $name)
153
154 #--------------------------------------------------------------------#
155 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
156 #--------------------------------------------------------------------#
157 #
158 # Drop in the name of the target on a new line, and the previous target
159 # as a dependency. Also call the echo_message function.
160 LUSER_wrt_target "${this_script}" "$PREV"
161 #
162 # If $pkg_tarball isn't empty, we've got a package...
163 #
164 [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
165 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = 3 ]] && wrt_makeflags "${name}"
166 #
167 LUSER_wrt_RunAsUser "${file}"
168 #
169 [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
170 #
171 # Include a touch of the target name so make can check if it's already been made.
172 wrt_touch
173 #
174 #--------------------------------------------------------------------#
175 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
176 #--------------------------------------------------------------------#
177 #
178 # Keep the script file name for Makefile dependencies.
179 PREV=$this_script
180
181 done # for file in ....
182}
183
184#--------------------------------------#
185temptools_Makefiles() { #
186#--------------------------------------#
187 echo "${tab_}${GREEN}Processing... ${L_arrow}temp system ( LUSER ) ${R_arrow}"
188
189 for file in temp-system/* ; do
190 # Keep the script file name
191 this_script=`basename $file`
192 #
193 # Deal with any odd scripts..
194 case $this_script in
195 *choose) # The choose script will fail if you cannot enter the new environment
196 # If the 'boot' build method was chosen don't run the script
197 [[ $METHOD = "boot" ]] && continue; ;;
198 *) ;;
199 esac
200
201 #
202 # First append each name of the script files to a list (this will become
203 # the names of the targets in the Makefile
204 temptools="$temptools $this_script"
205
206 #
207 # Grab the name of the target, strip id number, XXX-script
208 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
209 #
210 pkg_tarball=$(get_package_tarball_name $name)
211
212 #--------------------------------------------------------------------#
213 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
214 #--------------------------------------------------------------------#
215 #
216 # Drop in the name of the target on a new line, and the previous target
217 # as a dependency. Also call the echo_message function.
218 LUSER_wrt_target "${this_script}" "$PREV"
219 #
220 # If $pkg_tarball isn't empty, we've got a package...
221 # Insert instructions for unpacking the package and to set the PKGDIR variable.
222 #
223 [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
224 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
225 #
226 LUSER_wrt_RunAsUser "${file}"
227 #
228 [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
229 #
230 # Include a touch of the target name so make can check if it's already been made.
231 wrt_touch
232 #
233 #--------------------------------------------------------------------#
234 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
235 #--------------------------------------------------------------------#
236 #
237 # Keep the script file name for Makefile dependencies.
238 PREV=$this_script
239 done # for file in ....
240}
241
242
243#--------------------------------------#
244chroot_Makefiles() { #
245#--------------------------------------#
246 echo "${tab_}${GREEN}Processing... ${L_arrow}tmptools CHROOT ( CHROOT ) ${R_arrow}"
247
248 for file in chroot/* ; do
249 # Keep the script file name
250 this_script=`basename $file`
251 #
252 # Skipping scripts is done now and not included in the build tree.
253 case $this_script in
254 *chroot*) continue ;;
255 esac
256
257 #
258 # First append each name of the script files to a list (this will become
259 # the names of the targets in the Makefile
260 case "${this_script}" in
261 *kernfs) orphan_scripts="${orphan_scripts} ${this_script}" ;;
262 *) chroottools="$chroottools $this_script" ;;
263 esac
264
265 # Grab the name of the target, strip id number, XXX-script
266 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
267
268 pkg_tarball=$(get_package_tarball_name $name)
269
270 # This is very ugly:: util-linux is in /chroot but must be run under LUSER
271 # Same for e2fsprogs (in CLFS 1.1.0)
272 # .. Customized makefile entry
273 case "${this_script}" in
274 *util-linux)
275 LUSER_wrt_target "${this_script}" "$PREV"
276 LUSER_wrt_unpack "$pkg_tarball"
277 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
278 LUSER_wrt_RunAsUser "${file}"
279 LUSER_RemoveBuildDirs "${name}"
280 wrt_touch
281 temptools="$temptools $this_script"
282 continue ;;
283 *util-linux-ng)
284 LUSER_wrt_target "${this_script}" "$PREV"
285 LUSER_wrt_unpack "$pkg_tarball"
286 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
287 LUSER_wrt_RunAsUser "${file}"
288 LUSER_RemoveBuildDirs "${name}"
289 wrt_touch
290 temptools="$temptools $this_script"
291 continue ;;
292 *util-linux-libs)
293 LUSER_wrt_target "${this_script}" "$PREV"
294 LUSER_wrt_unpack "$pkg_tarball"
295 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
296 LUSER_wrt_RunAsUser "${file}"
297 LUSER_RemoveBuildDirs "${name}"
298 wrt_touch
299 temptools="$temptools $this_script"
300 continue ;;
301 *e2fsprogs)
302 LUSER_wrt_target "${this_script}" "$PREV"
303 LUSER_wrt_unpack "$pkg_tarball"
304 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
305 LUSER_wrt_RunAsUser "${file}"
306 LUSER_RemoveBuildDirs "${name}"
307 wrt_touch
308 temptools="$temptools $this_script"
309 continue ;;
310 *e2fsprogs-libs)
311 LUSER_wrt_target "${this_script}" "$PREV"
312 LUSER_wrt_unpack "$pkg_tarball"
313 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
314 LUSER_wrt_RunAsUser "${file}"
315 LUSER_RemoveBuildDirs "${name}"
316 wrt_touch
317 temptools="$temptools $this_script"
318 continue ;;
319 esac
320
321
322 #--------------------------------------------------------------------#
323 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
324 #--------------------------------------------------------------------#
325 #
326 # Drop in the name of the target on a new line, and the previous target
327 # as a dependency. Also call the echo_message function.
328 CHROOT_wrt_target "${this_script}" "$PREV"
329 #
330 # If $pkg_tarball isn't empty, we've got a package...
331 # Insert instructions for unpacking the package and changing directories
332 #
333 if [ "$pkg_tarball" != "" ] ; then
334 CHROOT_Unpack "$pkg_tarball"
335 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
336 fi
337 #
338 # Select a script execution method
339 case $this_script in
340 *kernfs) wrt_RunAsRoot "${file}" ;;
341 *) CHROOT_wrt_RunAsRoot "${file}" ;;
342 esac
343 #
344 # Housekeeping...remove the build directory(ies), except if the package build fails.
345 [[ "$pkg_tarball" != "" ]] && CHROOT_wrt_RemoveBuildDirs "${name}"
346 #
347 # Include a touch of the target name so make can check if it's already been made.
348 wrt_touch
349 #
350 #--------------------------------------------------------------------#
351 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
352 #--------------------------------------------------------------------#
353 #
354 # Keep the script file name for Makefile dependencies.
355 PREV=$this_script
356
357 done # for file in...
358}
359
360
361#--------------------------------------#
362boot_Makefiles() { #
363#--------------------------------------#
364
365 echo "${tab_}${GREEN}Processing... ${L_arrow}tmptools BOOT ( LUSER ) ${R_arrow}"
366 #
367 # Create a target bootable partition containing a compile environment. Later
368 # on we boot into this environment and contine the build.
369 #
370 for file in boot/* ; do
371 # Keep the script file name
372 this_script=`basename $file`
373
374 # A little housekeeping on the scripts
375 case $this_script in
376 *grub | *aboot | *colo | *silo | *arcload | *lilo | *introduction ) continue ;;
377 *how-to-view*) continue ;;
378 *whatnext*) continue ;;
379 *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
380 *kernel) # if there is no kernel config file do not build the kernel
381 [[ -z $CONFIG ]] && continue
382 # Copy the config file to /sources with a standardized name
383 cp $BOOT_CONFIG $BUILDDIR/sources/bootkernel-config
384 ;;
385 esac
386 #
387 # First append each name of the script files to a list (this will become
388 # the names of the targets in the Makefile). Those names differ depending
389 # on the version of the book. What makes the difference between those
390 # versions is the presence of "how-to-view" in the boot chapter.
391 if [ -f boot/*how-to-view ]; then
392 case "${this_script}" in
393 *changingowner)
394 orphan_scripts="${orphan_scripts} ${this_script}"
395 ;;
396 *creatingdirs)
397 orphan_scripts="${orphan_scripts} ${this_script}"
398 ;;
399 *createfiles)
400 orphan_scripts="${orphan_scripts} ${this_script}"
401 ;;
402 *devices)
403 orphan_scripts="${orphan_scripts} ${this_script}"
404 ;;
405 *flags)
406 orphan_scripts="${orphan_scripts} ${this_script}"
407 ;;
408 *fstab)
409 orphan_scripts="${orphan_scripts} ${this_script}"
410 ;;
411 *pwdgroup)
412 orphan_scripts="${orphan_scripts} ${this_script}"
413 ;;
414 *settingenvironment)
415 orphan_scripts="${orphan_scripts} ${this_script}"
416 ;;
417 *)
418 boottools="$boottools $this_script"
419 ;;
420 esac
421 else
422 case "${this_script}" in
423 *changingowner)
424 orphan_scripts="${orphan_scripts} ${this_script}"
425 ;;
426 *devices)
427 orphan_scripts="${orphan_scripts} ${this_script}"
428 ;;
429 *)
430 boottools="$boottools $this_script"
431 ;;
432 esac
433 fi
434 #
435 # Grab the name of the target, strip id number and misc words.
436 case $this_script in
437 *kernel) name=linux ;;
438 *bootscripts) name="bootscripts-cross-lfs" ;;
439 *boot-scripts) name="boot-scripts-cross-lfs" ;;
440 *udev-rules) name="udev-cross-lfs" ;;
441 *grub-build) name=grub ;;
442 *-aboot-build) name=aboot ;;
443 *yaboot-build) name=yaboot ;;
444 *colo-build) name=colo ;;
445 *silo-build) name=silo ;;
446 *arcload-build) name=arcload ;;
447 *lilo-build) name=lilo ;;
448 *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
449 esac
450 # Identify the unique version naming scheme for the clfs bootscripts..(bad boys)
451 pkg_tarball=$(get_package_tarball_name $name)
452
453 #--------------------------------------------------------------------#
454 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
455 #--------------------------------------------------------------------#
456 #
457 # Drop in the name of the target on a new line, and the previous target
458 # as a dependency. Also call the echo_message function.
459 LUSER_wrt_target "${this_script}" "$PREV"
460 #
461 # If $pkg_tarball isn't empty, we've got a package...
462 # Insert instructions for unpacking the package and changing directories
463 #
464 [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
465 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
466 #
467 # Select a script execution method
468 if [ -f boot/*how-to-view ]; then
469 case $this_script in
470 # The following 8 scripts are defined in the /boot directory but need
471 # to be run as a root user. Set them up here but run them in another
472 # phase
473 *changingowner) wrt_RunAsRoot "${file}" ;;
474 *creatingdirs) wrt_RunAsRoot "${file}" ;;
475 *createfiles) wrt_RunAsRoot "${file}" ;;
476 *devices) wrt_RunAsRoot "${file}" ;;
477 *flags) wrt_RunAsRoot "${file}" ;;
478 *fstab)
479 if [[ -n "$FSTAB" ]]; then
480 LUSER_wrt_CopyFstab
481 else
482 wrt_RunAsRoot "${file}"
483 fi
484 ;;
485 *pwdgroup) wrt_RunAsRoot "${file}" ;;
486 *settingenvironment) wrt_RunAsRoot "${file}" ;;
487 *) LUSER_wrt_RunAsUser "${file}" ;;
488 esac
489 else
490 case $this_script in
491 # The following 2 scripts are defined in the /boot directory but need
492 # to be run as a root user. Set them up here but run them in another
493 # phase
494 *changingowner) wrt_RunAsRoot "${file}" ;;
495 *devices) wrt_RunAsRoot "${file}" ;;
496 *fstab)
497 if [[ -n "$FSTAB" ]]; then
498 LUSER_wrt_CopyFstab
499 else
500 LUSER_wrt_RunAsUser "${file}"
501 fi
502 ;;
503 *) LUSER_wrt_RunAsUser "${file}" ;;
504 esac
505 fi
506 #
507 # Housekeeping...remove any build directory(ies) except if the package build fails.
508 [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
509 #
510 # Include a touch of the target name so make can check if it's already been made.
511 wrt_touch
512 #
513 #--------------------------------------------------------------------#
514 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
515 #--------------------------------------------------------------------#
516 #
517 # Keep the script file name for Makefile dependencies.
518 PREV=$this_script
519
520 done
521}
522
523
524#--------------------------------------#
525testsuite_tools_Makefiles() { #
526#--------------------------------------#
527
528 if [[ "${METHOD}" = "chroot" ]]; then
529 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools ( CHROOT ) ${R_arrow}"
530 else
531 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools ( ROOT ) ${R_arrow}"
532 PREV=""
533 fi
534
535 for file in testsuite-tools/* ; do
536 # Keep the script file name
537 this_script=`basename $file`
538
539 # First append each name of the script files to a list (this will become
540 # the names of the targets in the Makefile
541 testsuitetools="$testsuitetools $this_script"
542
543 # Grab the name of the target, strip id number, XXX-script
544 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
545 -e 's@-64bit@@' \
546 -e 's@-64@@' \
547 -e 's@64@@' \
548 -e 's@n32@@'`
549
550 pkg_tarball=$(get_package_tarball_name $name)
551
552 #--------------------------------------------------------------------#
553 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
554 #--------------------------------------------------------------------#
555 #
556 # Drop in the name of the target on a new line, and the previous target
557 # as a dependency. Also call the echo_message function.
558 CHROOT_wrt_target "${this_script}" "$PREV"
559 #
560 CHROOT_Unpack "$pkg_tarball"
561 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
562 #
563 CHROOT_wrt_RunAsRoot "${file}"
564 #
565 CHROOT_wrt_RemoveBuildDirs "${name}"
566 #
567 # Include a touch of the target name so make can check if it's already been made.
568 wrt_touch
569 #
570 #--------------------------------------------------------------------#
571 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
572 #--------------------------------------------------------------------#
573 #
574 # Keep the script file name for Makefile dependencies.
575 PREV=$this_script
576
577 done
578}
579
580
581#--------------------------------------#
582final_system_Makefiles() { #
583#--------------------------------------#
584 # Set envars and scripts for iteration targets
585 if [[ -z "$1" ]] ; then
586 local N=""
587 # In boot method the makesys phase was initiated in testsuite_tools_makefile
588 [[ "${METHOD}" = "boot" ]] && [[ "$TEST" = 0 ]] && PREV=""
589 else
590 local N=-build_$1
591 local basicsystem=""
592 mkdir final-system$N
593 cp final-system/* final-system$N
594 for script in final-system$N/* ; do
595 # Overwrite existing symlinks, files, and dirs
596 sed -e 's/ln -sv/&f/g' \
597 -e 's/mv -v/&f/g' \
598 -e 's/mkdir -v/&p/g' -i ${script}
599 # Rename the scripts
600 mv ${script} ${script}$N
601 done
602 # Remove Bzip2 binaries before make install (CLFS-1.0 compatibility)
603 sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2$N
604 # Delete *old Readline libraries just after make install
605 sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline$N
606 fi
607
608 if [[ "${METHOD}" = "chroot" ]]; then
609 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system$N ( CHROOT ) ${R_arrow}"
610 else
611 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system$N ( ROOT ) ${R_arrow}"
612 fi
613
614 for file in final-system$N/* ; do
615 # Keep the script file name
616 this_script=`basename $file`
617
618 # Test if the stripping phase must be skipped.
619 # Skip also temp-perl for iterative runs
620 case $this_script in
621 *stripping*) [[ "$STRIP" = "n" ]] && continue ;;
622 *temp-perl*) [[ -n "$N" ]] && continue ;;
623 esac
624
625 # Grab the name of the target, strip id number, XXX-script.
626 # name1 is partially stripped and should be used for logging files.
627 # name is completely stripped and is used for grabbing
628 # the package name.
629 name1=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
630 -e 's,'$N',,'`
631 name=`echo $name1 | sed -e 's@temp-@@' \
632 -e 's@-64bit@@' \
633 -e 's@-64@@' \
634 -e 's@64@@' \
635 -e 's@n32@@'`
636
637 # Find the version of the command files, if it corresponds with the building of
638 # a specific package. We need this here to can skip scripts not needed for
639 # iterations rebuilds
640 pkg_tarball=$(get_package_tarball_name $name)
641
642 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
643 case "${this_script}" in
644 *stripping*) ;;
645 *) continue ;;
646 esac
647 fi
648
649 # Append each name of the script files to a list (this will become
650 # the names of the targets in the Makefile
651 basicsystem="$basicsystem ${this_script}"
652
653 #--------------------------------------------------------------------#
654 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
655 #--------------------------------------------------------------------#
656 #
657 # Drop in the name of the target on a new line, and the previous target
658 # as a dependency. Also call the echo_message function.
659 CHROOT_wrt_target "${this_script}" "$PREV"
660
661 # If $pkg_tarball isn't empty, we've got a package...
662 if [ "$pkg_tarball" != "" ] ; then
663 # Touch timestamp file if installed files logs will be created.
664 # But only for the firt build when running iterative builds.
665 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
666 CHROOT_wrt_TouchTimestamp
667 fi
668 CHROOT_Unpack "$pkg_tarball"
669 # If the testsuites must be run, initialize the log file
670 case $name in
671 binutils | gcc | glibc | eglibc | gmp | mpfr | mpc | isl | cloog )
672 [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}"
673 ;;
674 * )
675 [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && CHROOT_wrt_test_log "${this_script}"
676 ;;
677 esac
678 # If using optimizations, write the instructions
679 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
680 fi
681 #
682 CHROOT_wrt_RunAsRoot "${file}"
683 #
684 # Write installed files log and remove the build directory(ies)
685 # except if the package build fails.
686 if [ "$pkg_tarball" != "" ] ; then
687 CHROOT_wrt_RemoveBuildDirs "$name"
688 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
689 CHROOT_wrt_LogNewFiles "$name1"
690 fi
691 fi
692 #
693 # Include a touch of the target name so make can check
694 # if it's already been made.
695 wrt_touch
696 #
697 #--------------------------------------------------------------------#
698 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
699 #--------------------------------------------------------------------#
700 #
701 # Keep the script file name for Makefile dependencies.
702 PREV=${this_script}
703 # Set system_build envar for iteration targets
704 system_build=$basicsystem
705 done # for file in final-system/* ...
706}
707
708#--------------------------------------#
709bootscripts_Makefiles() { #
710#--------------------------------------#
711
712# New versions of the book do not have bootscripts anymore
713# (use systemd configuration files)
714# Define a variable to be used for the right script directory to parse
715 if [ -d bootscripts ]; then
716 config="bootscripts"
717 else
718 config="system-config"
719 fi
720
721 if [[ "${METHOD}" = "chroot" ]]; then
722 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) $config ( CHROOT ) ${R_arrow}"
723 else
724 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) $config ( ROOT ) ${R_arrow}"
725 fi
726
727 for file in $config/* ; do
728 # Keep the script file name
729 this_script=`basename $file`
730
731 case $this_script in
732 *udev) continue ;; # This is not a script but a commentary, we want udev-rules
733 *console*) continue ;; # Use the files that came with the bootscripts
734# fstab is now here (for 3.x.y)
735 *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
736 *) ;;
737 esac
738
739 # First append each name of the script files to a list (this will become
740 # the names of the targets in the Makefile
741 bootscripttools="$bootscripttools $this_script"
742
743 # Grab the name of the target, strip id number, XXX-script.
744 # name1 is partially stripped and should be used for logging files.
745 # name is completely stripped and is used for grabbing
746 # the package name.
747 name1=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
748 name=`echo $name1 | sed -e 's@-64bit@@' \
749 -e 's@-64@@' \
750 -e 's@64@@' \
751 -e 's@n32@@'`
752 case $name in
753 *bootscripts*) name=bootscripts-cross-lfs ;;
754 *udev-rules) name=udev-cross-lfs ;;
755 esac
756
757 pkg_tarball=$(get_package_tarball_name $name)
758
759 #--------------------------------------------------------------------#
760 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
761 #--------------------------------------------------------------------#
762 #
763 # Drop in the name of the target on a new line, and the previous target
764 # as a dependency. Also call the echo_message function.
765 CHROOT_wrt_target "${this_script}" "$PREV"
766 #
767 # If $pkg_tarball isn't empty, we've got a package...
768 #
769 if [ "$pkg_tarball" != "" ] ; then
770 if [ "${INSTALL_LOG}" = "y" ] ; then
771 CHROOT_wrt_TouchTimestamp
772 fi
773 CHROOT_Unpack "$pkg_tarball"
774 fi
775 #
776 case $this_script in
777 *fstab*) if [[ -n "$FSTAB" ]]; then
778 CHROOT_wrt_CopyFstab
779 else
780 CHROOT_wrt_RunAsRoot "${file}"
781 fi
782 ;;
783 *) CHROOT_wrt_RunAsRoot "${file}"
784 ;;
785 esac
786 #
787 # Write installed files log and remove the build directory(ies)
788 # except if the package build fails.
789 if [ "$pkg_tarball" != "" ] ; then
790 CHROOT_wrt_RemoveBuildDirs "$name"
791 if [ "${INSTALL_LOG}" = "y" ] ; then
792 CHROOT_wrt_LogNewFiles "$name1"
793 fi
794 fi
795 #
796 # Include a touch of the target name so make can check if it's already been made.
797 wrt_touch
798 #
799 #--------------------------------------------------------------------#
800 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
801 #--------------------------------------------------------------------#
802 #
803 # Keep the script file name for Makefile dependencies.
804 PREV=$this_script
805
806 done # for file in bootscripts/* ...
807}
808
809#--------------------------------------#
810network_Makefiles() { #
811#--------------------------------------#
812
813 if [[ "${METHOD}" = "chroot" ]]; then
814 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) network ( CHROOT ) ${R_arrow}"
815 else
816 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) network ( ROOT ) ${R_arrow}"
817 fi
818
819 for file in network/* ; do
820 # Keep the script file name
821 this_script=`basename $file`
822
823 case $this_script in
824 *choose) continue ;; # This is not a script but a commentary.
825 *dhcp) continue ;; # Assume static networking.
826 *dhcpcd) continue ;; # Assume static networking.
827 *) ;;
828 esac
829
830 # First append each name of the script files to a list (this will become
831 # the names of the targets in the Makefile
832 networktools="$networktools $this_script"
833
834 # Grab the name of the target, strip id number, XXX-script
835 # name1 is partially stripped and should be used for logging files.
836 # name is completely stripped and is used for grabbing
837 # the package name.
838 name1=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
839 name=`echo $name1 | sed -e 's@-64bit@@' \
840 -e 's@-64@@' \
841 -e 's@64@@' \
842 -e 's@n32@@'`
843 case $name in
844 network-scripts) name=clfs-network-scripts ;;
845 esac
846
847 pkg_tarball=$(get_package_tarball_name $name)
848
849 #--------------------------------------------------------------------#
850 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
851 #--------------------------------------------------------------------#
852 #
853 # Drop in the name of the target on a new line, and the previous target
854 # as a dependency. Also call the echo_message function.
855 CHROOT_wrt_target "${this_script}" "$PREV"
856 #
857 # If $pkg_tarball isn't empty, we've got a package...
858 #
859 if [ "$pkg_tarball" != "" ] ; then
860 if [ "${INSTALL_LOG}" = "y" ] ; then
861 CHROOT_wrt_TouchTimestamp
862 fi
863 CHROOT_Unpack "$pkg_tarball"
864 fi
865 #
866 CHROOT_wrt_RunAsRoot "${file}"
867 #
868 # Write installed files log and remove the build directory(ies)
869 # except if the package build fails.
870 if [ "$pkg_tarball" != "" ] ; then
871 CHROOT_wrt_RemoveBuildDirs "$name"
872 if [ "${INSTALL_LOG}" = "y" ] ; then
873 CHROOT_wrt_LogNewFiles "$name1"
874 fi
875 fi
876 #
877 # Include a touch of the target name so make can check if it's already been made.
878 wrt_touch
879 #
880 #--------------------------------------------------------------------#
881 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
882 #--------------------------------------------------------------------#
883 #
884 # Keep the script file name for Makefile dependencies.
885 PREV=$this_script
886
887 done # for file in network/* ...
888}
889
890#--------------------------------------#
891bootable_Makefiles() { #
892#--------------------------------------#
893
894 if [[ "${METHOD}" = "chroot" ]]; then
895 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable ( CHROOT ) ${R_arrow}"
896 else
897 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable ( ROOT ) ${R_arrow}"
898 fi
899
900
901 for file in bootable/* ; do
902 # Keep the script file name
903 this_script=`basename $file`
904
905 # A little housekeeping on the scripts
906 case $this_script in
907 *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
908 *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
909 *kernel) # if there is no kernel config file do not build the kernel
910 [[ -z $CONFIG ]] && continue
911 # Copy the config file to /sources with a standardized name
912 cp $CONFIG $BUILDDIR/sources/kernel-config
913 ;;
914 esac
915 #
916 # First append each name of the script files to a list (this will become
917 # the names of the targets in the Makefile
918 bootabletools="$bootabletools $this_script"
919 #
920 # Grab the name of the target, strip id number and misc words.
921 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
922 case $this_script in
923 *kernel*) name=linux
924 ;;
925 esac
926
927 pkg_tarball=$(get_package_tarball_name $name)
928
929 #--------------------------------------------------------------------#
930 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
931 #--------------------------------------------------------------------#
932 #
933 # Drop in the name of the target on a new line, and the previous target
934 # as a dependency. Also call the echo_message function.
935 CHROOT_wrt_target "${this_script}" "$PREV"
936 #
937 # If $pkg_tarball isn't empty, we've got a package...
938 # Insert instructions for unpacking the package and changing directories
939 #
940 if [ "$pkg_tarball" != "" ] ; then
941 if [ "${INSTALL_LOG}" = "y" ] ; then
942 CHROOT_wrt_TouchTimestamp
943 fi
944 CHROOT_Unpack "$pkg_tarball"
945 fi
946 #
947 # Select a script execution method
948 case $this_script in
949 *fstab*) if [[ -n "$FSTAB" ]]; then
950 CHROOT_wrt_CopyFstab
951 else
952 CHROOT_wrt_RunAsRoot "${file}"
953 fi
954 ;;
955 *) CHROOT_wrt_RunAsRoot "${file}"
956 ;;
957 esac
958 #
959 # Write installed files log and remove the build directory(ies)
960 # except if the package build fails.
961 if [ "$pkg_tarball" != "" ] ; then
962 CHROOT_wrt_RemoveBuildDirs "$name"
963 if [ "${INSTALL_LOG}" = "y" ] ; then
964 CHROOT_wrt_LogNewFiles "$name"
965 fi
966 fi
967 #
968 # Include a touch of the target name so make can check if it's already been made.
969 wrt_touch
970 #
971 #--------------------------------------------------------------------#
972 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
973 #--------------------------------------------------------------------#
974 #
975 # Keep the script file name for Makefile dependencies.
976 PREV=$this_script
977
978 done
979
980}
981
982
983#--------------------------------------#
984build_Makefile() { # Construct a Makefile from the book scripts
985#--------------------------------------#
986
987 echo "...Creating Makefile... ${BOLD}START${OFF}"
988
989 cd $JHALFSDIR/${PROGNAME}-commands
990 # Start with clean files
991 >$MKFILE
992 >$MKFILE.tmp
993
994 method_cmds=${METHOD}_Makefiles
995
996 host_prep_Makefiles # mk_SETUP (SETUP) $host_prep
997 final_preps_Makefiles # mk_F_PREPS (LUSER) $final_preps
998 cross_tools_Makefiles # mk_CROSS (LUSER) $cross_tools
999 temptools_Makefiles # mk_TEMP (LUSER) $temptools
1000 $method_cmds # mk_SYSTOOLS (CHROOT) $chroottools/$boottools
1001 if [[ ! $TEST = "0" ]]; then
1002 testsuite_tools_Makefiles # mk_SYSTOOLS (CHROOT) $testsuitetools
1003 fi
1004 final_system_Makefiles # mk_FINAL (CHROOT) $basicsystem
1005 # Add the iterations targets, if needed
1006 [[ "$COMPARE" = "y" ]] && wrt_compare_targets
1007 bootscripts_Makefiles # mk_BOOTSCRIPT (CHROOT) $bootscripttools
1008 if [ -d network ]; then
1009 network_Makefiles # If present, process network setup.
1010 fi
1011 bootable_Makefiles # mk_BOOTABLE (CHROOT) $bootabletools
1012
1013 # Add the CUSTOM_TOOLS targets, if needed
1014 [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
1015
1016 # Add a header, some variables and include the function file
1017 # to the top of the real Makefile.
1018 wrt_Makefile_header
1019
1020 # Add chroot commands
1021 if [ "$METHOD" = "chroot" ] ; then
1022 CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
1023 chroot=`cat chroot/???-chroot | \
1024 sed -e "s@chroot@$CHROOT_LOC@" \
1025 -e '/#!\/bin\/bash/d' \
1026 -e '/^export/d' \
1027 -e '/^logout/d' \
1028 -e 's@ \\\@ @g' | \
1029 tr -d '\n' | \
1030 sed -e 's/ */ /g' \
1031 -e 's|\\$|&&|g' \
1032 -e 's|exit||g' \
1033 -e 's|$| -c|' \
1034 -e 's|"$${CLFS}"|$(MOUNT_PT)|'\
1035 -e 's|set -e||' \
1036 -e 's|set +h||'`
1037 echo -e "CHROOT1= $chroot\n" >> $MKFILE
1038 fi
1039
1040################## CHROOT ####################
1041
1042if [[ "${METHOD}" = "chroot" ]]; then
1043(
1044cat << EOF
1045
1046all: ck_UID mk_SETUP mk_F_PREPS mk_SUDO mk_SYSTOOLS create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL
1047 @sudo make do-housekeeping
1048 @echo "$VERSION - jhalfs build" > clfs-release && \\
1049 sudo mv clfs-release \$(MOUNT_PT)/etc && \\
1050 sudo chown root:root \$(MOUNT_PT)/etc/clfs-release
1051 @\$(call echo_finished,$VERSION)
1052
1053ck_UID:
1054 @if [ \`id -u\` = "0" ]; then \\
1055 echo "+--------------------------------------------------+"; \\
1056 echo "|You cannot run this makefile from the root account|"; \\
1057 echo "+--------------------------------------------------+"; \\
1058 exit 1; \\
1059 fi
1060
1061#---------------AS ROOT
1062mk_SETUP:
1063 @\$(call echo_SU_request)
1064 @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
1065 @touch \$@
1066
1067#---------------AS LUSER
1068mk_F_PREPS: mk_SETUP
1069 @\$(call echo_PHASE,Final Preparations Cross and Temporary Tools)
1070 @( \$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) AS_LUSER" )
1071 @sudo make restore-luser-env
1072 @touch \$@
1073
1074mk_SUDO: mk_F_PREPS
1075 @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
1076 @touch \$@
1077
1078#---------------CHROOT JAIL
1079mk_SYSTOOLS: mk_SUDO
1080 @\$(call echo_CHROOT_request)
1081 @\$(call echo_PHASE, CHROOT JAIL )
1082 @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) PREP_CHROOT_JAIL")
1083 @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT_JAIL")
1084 @touch \$@
1085
1086mk_BLFS_TOOL: create-sbu_du-report
1087 @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
1088 \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
1089 (sudo \$(CHROOT1) "make -C $BLFS_ROOT/work"); \\
1090 fi;
1091 @touch \$@
1092
1093mk_CUSTOM_TOOLS: mk_BLFS_TOOL
1094 @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
1095 \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
1096 sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
1097 (sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
1098 fi;
1099 @touch \$@
1100
1101SETUP: $host_prep
1102AS_LUSER: $final_preps $cross_tools $temptools
1103SUDO: $orphan_scripts
1104PREP_CHROOT_JAIL: SHELL=/tools/bin/bash
1105PREP_CHROOT_JAIL: ${chroottools}
1106CHROOT_JAIL: SHELL=/tools/bin/bash
1107CHROOT_JAIL: $testsuitetools $basicsystem $bootscripttools $bootabletools
1108CUSTOM_TOOLS: $custom_list
1109
1110
1111create-sbu_du-report: mk_SYSTOOLS
1112 @\$(call echo_message, Building)
1113 @if [ "\$(ADD_REPORT)" = "y" ]; then \\
1114 ./create-sbu_du-report.sh logs $VERSION; \\
1115 \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
1116 fi;
1117 @touch \$@
1118
1119do-housekeeping:
1120 @-umount \$(MOUNT_PT)/dev/pts
1121 @-if [ -h \$(MOUNT_PT)/dev/shm ]; then \\
1122 link=\$\$(readlink \$(MOUNT_PT)/dev/shm); \\
1123 umount \$(MOUNT_PT)/\$\$link; \\
1124 unset link; \\
1125 else \\
1126 umount \$(MOUNT_PT)/dev/shm; \\
1127 fi
1128 @-umount \$(MOUNT_PT)/dev
1129 @-umount \$(MOUNT_PT)/sys
1130 @-umount \$(MOUNT_PT)/proc
1131 @-rm /tools /cross-tools
1132 @-if [ ! -f luser-exist ]; then \\
1133 userdel \$(LUSER); \\
1134 rm -rf \$(LUSER_HOME); \\
1135 fi;
1136
1137EOF
1138) >> $MKFILE
1139
1140fi
1141
1142################### BOOT #####################
1143
1144if [[ "${METHOD}" = "boot" ]]; then
1145(
1146cat << EOF
1147
1148all: ck_UID mk_SETUP mk_F_PREPS mk_SUDO
1149 @sudo make restore-luser-env
1150 @sudo make do-housekeeping
1151 @\$(call echo_boot_finished,$VERSION)
1152
1153makesys: mk_FINAL mk_CUSTOM_TOOLS mk_BLFS_TOOL
1154 @echo "$VERSION - jhalfs build" > /etc/clfs-release
1155 @\$(call echo_finished,$VERSION)
1156
1157
1158ck_UID:
1159 @if [ \`id -u\` = "0" ]; then \\
1160 echo "+--------------------------------------------------+"; \\
1161 echo "|You cannot run this makefile from the root account|"; \\
1162 echo "|However, if this is the boot environment |"; \\
1163 echo "| the command you are looking for is |"; \\
1164 echo "| make makesys |"; \\
1165 echo "| to complete the build |"; \\
1166 echo "+--------------------------------------------------+"; \\
1167 exit 1; \\
1168 fi
1169
1170#---------------AS ROOT
1171
1172mk_SETUP:
1173 @\$(call echo_SU_request)
1174 @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
1175 @touch \$@
1176
1177#---------------AS LUSER
1178
1179mk_F_PREPS: mk_SETUP
1180 @\$(call echo_PHASE,Final Preparations and Cross Tools)
1181 @( \$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) AS_LUSER" )
1182 @touch \$@
1183
1184mk_SUDO: mk_F_PREPS
1185 @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
1186 @touch \$@
1187
1188#---------------AS ROOT
1189
1190mk_FINAL:
1191 @\$(call echo_PHASE,Final System)
1192 @( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) AS_ROOT )
1193 @touch \$@
1194
1195mk_BLFS_TOOL: mk_FINAL
1196 @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
1197 \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
1198 ( make -C $BLFS_ROOT/work ); \\
1199 fi;
1200 @touch \$@
1201
1202mk_CUSTOM_TOOLS: mk_BLFS_TOOL
1203 @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
1204 \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
1205 mkdir -p ${TRACKING_DIR}; \\
1206 ( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS ); \\
1207 fi;
1208 @touch \$@
1209
1210SETUP: $host_prep
1211AS_LUSER: $final_preps $cross_tools $temptools ${boottools}
1212SUDO: $orphan_scripts
1213AS_ROOT: SHELL=/tools/bin/bash
1214AS_ROOT: $testsuitetools $basicsystem $bootscripttools $bootabletools
1215CUSTOM_TOOLS: $custom_list
1216
1217do-housekeeping:
1218 @-rm /tools /cross-tools
1219 @-if [ ! -f luser-exist ]; then \\
1220 userdel \$(LUSER); \\
1221 rm -rf \$(LUSER_HOME); \\
1222 fi;
1223
1224EOF
1225) >> $MKFILE
1226fi
1227
1228(
1229 cat << EOF
1230
1231restore-luser-env:
1232 @\$(call echo_message, Building)
1233 @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
1234 mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
1235 fi;
1236 @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
1237 mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
1238 fi;
1239 @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
1240 touch \$@ && \\
1241 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
1242 echo --------------------------------------------------------------------------------\$(WHITE)
1243
1244########################################################
1245
1246
1247EOF
1248) >> $MKFILE
1249
1250 # Bring over the items from the Makefile.tmp
1251 cat $MKFILE.tmp >> $MKFILE
1252 rm $MKFILE.tmp
1253
1254 echo "Creating Makefile... ${BOLD}DONE${OFF}"
1255}
Note: See TracBrowser for help on using the repository browser.