source: CLFS/master.sh@ 4ed4a32

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

Remove spaces at the end of lines

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