source: CLFS/master.sh@ 3f83cb0

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

For CLFS 3.0, variable setting is now in final-prep chapter.
Adapt CLFS for that

  • Property mode set to 100644
File size: 42.8 KB
RevLine 
[91ff6a9]1#!/bin/bash
[877cc6a]2# $Id$
3
[045b2dc]4
5orphan_scripts="" # 2 scripts do not fit BOOT_Makefiles LUSER environment
6
7
8#--------------------------------------#
9host_prep_Makefiles() { #
10#--------------------------------------#
[e2ec07a]11 local CLFS_HOST
[877cc6a]12
[045b2dc]13 echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files ( SETUP ) ${R_arrow}"
[877cc6a]14
15 # defined here, only for ease of reading
[ff4d1ab]16 CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
[877cc6a]17(
18cat << EOF
19023-creatingtoolsdir:
20 @\$(call echo_message, Building)
[269d81c]21 @install -dv \$(MOUNT_PT)/tools && \\
[e314f7e]22 rm -f /tools && \\
[dbcdfd7]23 ln -s \$(MOUNT_PT)/tools /
24 @\$(call housekeeping)
[877cc6a]25
26024-creatingcrossdir: 023-creatingtoolsdir
[9ae0875]27 @\$(call echo_message, Building)
[269d81c]28 @install -dv \$(MOUNT_PT)/cross-tools && \\
[e314f7e]29 rm -f /cross-tools && \\
[dbcdfd7]30 ln -s \$(MOUNT_PT)/cross-tools /
31 @\$(call housekeeping)
[877cc6a]32
33025-addinguser: 024-creatingcrossdir
34 @\$(call echo_message, Building)
[962793a]35 @if [ ! -d \$(LUSER_HOME) ]; then \\
[269d81c]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); \\
[877cc6a]40 else \\
[269d81c]41 touch luser-exist; \\
42 fi
43 @chown -v \$(LUSER) \$(MOUNT_PT)/tools && \\
44 chown -v \$(LUSER) \$(MOUNT_PT)/cross-tools && \\
[9ae0875]45 chmod -R a+wt \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
[dbcdfd7]46 chmod a+wt \$(SRCSDIR)
47 @\$(call housekeeping)
[877cc6a]48
49026-settingenvironment: 025-addinguser
50 @\$(call echo_message, Building)
[962793a]51 @if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
52 mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
[269d81c]53 fi
[962793a]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; \\
[877cc6a]56 fi;
[962793a]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 && \\
[3f83cb0]67EOF
68) >> $MKFILE.tmp
69if ! [ -e final-preps/*variables ]; then
70 (
71 cat << EOF
[962793a]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 && \\
[3f83cb0]75EOF
76 ) >> $MKFILE.tmp
77fi
78(
79cat << EOF
[962793a]80 echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc
81 @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
[e18f80a]82 chmod a+wt \$(MOUNT_PT) && \\
[b2c7742]83 if [ -d \$(MOUNT_PT)/var ]; then \\
84 chown -R \$(LUSER) \$(MOUNT_PT)/var; \\
85 fi && \\
[877cc6a]86 touch envars && \\
[e18f80a]87 chown \$(LUSER):\$(LGROUP) envars
[dbcdfd7]88 @\$(call housekeeping)
[877cc6a]89EOF
90) >> $MKFILE.tmp
[045b2dc]91 host_prep=" 023-creatingtoolsdir 024-creatingcrossdir 026-settingenvironment"
[877cc6a]92
93}
94
[3f83cb0]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
[045b2dc]122#--------------------------------------#
123cross_tools_Makefiles() { #
124#--------------------------------------#
125 echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools ( LUSER ) ${R_arrow}"
[877cc6a]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@@' \
[480295c]150 -e 's@-64@@' \
[877cc6a]151 -e 's@-n32@@'`
[a160d86]152 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]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.
[045b2dc]160 LUSER_wrt_target "${this_script}" "$PREV"
[877cc6a]161 #
[a160d86]162 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]163 #
[045b2dc]164 [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
[ce262a7]165 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = 3 ]] && wrt_makeflags "${name}"
[877cc6a]166 #
[045b2dc]167 LUSER_wrt_RunAsUser "${file}"
[877cc6a]168 #
[045b2dc]169 [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
[877cc6a]170 #
171 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]172 wrt_touch
[877cc6a]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
[045b2dc]184#--------------------------------------#
185temptools_Makefiles() { #
186#--------------------------------------#
187 echo "${tab_}${GREEN}Processing... ${L_arrow}temp system ( LUSER ) ${R_arrow}"
[877cc6a]188
189 for file in temp-system/* ; do
190 # Keep the script file name
191 this_script=`basename $file`
[6f2cd96]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
[e2ec07a]200
[877cc6a]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 #
[a160d86]210 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]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.
[045b2dc]218 LUSER_wrt_target "${this_script}" "$PREV"
[877cc6a]219 #
[a160d86]220 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]221 # Insert instructions for unpacking the package and to set the PKGDIR variable.
222 #
[045b2dc]223 [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
[ce262a7]224 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[877cc6a]225 #
[045b2dc]226 LUSER_wrt_RunAsUser "${file}"
[877cc6a]227 #
[045b2dc]228 [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
[877cc6a]229 #
230 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]231 wrt_touch
[877cc6a]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
[045b2dc]243#--------------------------------------#
244chroot_Makefiles() { #
245#--------------------------------------#
246 echo "${tab_}${GREEN}Processing... ${L_arrow}tmptools CHROOT ( CHROOT ) ${R_arrow}"
[877cc6a]247
[045b2dc]248 for file in chroot/* ; do
[877cc6a]249 # Keep the script file name
250 this_script=`basename $file`
[045b2dc]251 #
252 # Skipping scripts is done now and not included in the build tree.
[877cc6a]253 case $this_script in
[045b2dc]254 *chroot*) continue ;;
[877cc6a]255 esac
[045b2dc]256
[877cc6a]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
[045b2dc]260 case "${this_script}" in
261 *kernfs) orphan_scripts="${orphan_scripts} ${this_script}" ;;
262 *) chroottools="$chroottools $this_script" ;;
[877cc6a]263 esac
[045b2dc]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
[a160d86]268 pkg_tarball=$(get_package_tarball_name $name)
269
[045b2dc]270 # This is very ugly:: util-linux is in /chroot but must be run under LUSER
[608fbe1]271 # Same for e2fsprogs (in CLFS 1.1.0)
[045b2dc]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"
[ce262a7]277 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[045b2dc]278 LUSER_wrt_RunAsUser "${file}"
279 LUSER_RemoveBuildDirs "${name}"
280 wrt_touch
[480295c]281 temptools="$temptools $this_script"
282 continue ;;
[608fbe1]283 *util-linux-ng)
284 LUSER_wrt_target "${this_script}" "$PREV"
285 LUSER_wrt_unpack "$pkg_tarball"
[ce262a7]286 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[608fbe1]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"
[ce262a7]295 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[608fbe1]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"
[ce262a7]304 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[608fbe1]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"
[ce262a7]313 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[608fbe1]314 LUSER_wrt_RunAsUser "${file}"
315 LUSER_RemoveBuildDirs "${name}"
316 wrt_touch
317 temptools="$temptools $this_script"
318 continue ;;
[045b2dc]319 esac
320
321
[877cc6a]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.
[045b2dc]328 CHROOT_wrt_target "${this_script}" "$PREV"
[877cc6a]329 #
[a160d86]330 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]331 # Insert instructions for unpacking the package and changing directories
332 #
[045b2dc]333 if [ "$pkg_tarball" != "" ] ; then
[8f2c086]334 CHROOT_Unpack "$pkg_tarball"
[ce262a7]335 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[045b2dc]336 fi
[877cc6a]337 #
338 # Select a script execution method
339 case $this_script in
[8f2c086]340 *kernfs) wrt_RunAsRoot "${file}" ;;
[045b2dc]341 *) CHROOT_wrt_RunAsRoot "${file}" ;;
[877cc6a]342 esac
343 #
[045b2dc]344 # Housekeeping...remove the build directory(ies), except if the package build fails.
345 [[ "$pkg_tarball" != "" ]] && CHROOT_wrt_RemoveBuildDirs "${name}"
[877cc6a]346 #
347 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]348 wrt_touch
[877cc6a]349 #
350 #--------------------------------------------------------------------#
351 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
352 #--------------------------------------------------------------------#
353 #
354 # Keep the script file name for Makefile dependencies.
355 PREV=$this_script
356
[045b2dc]357 done # for file in...
[877cc6a]358}
359
360
[045b2dc]361#--------------------------------------#
362boot_Makefiles() { #
363#--------------------------------------#
[877cc6a]364
[045b2dc]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
[877cc6a]371 # Keep the script file name
372 this_script=`basename $file`
[045b2dc]373
374 # A little housekeeping on the scripts
[877cc6a]375 case $this_script in
[f940c29]376 *grub | *aboot | *colo | *silo | *arcload | *lilo | *introduction ) continue ;;
[179ae85]377 *how-to-view*) continue ;;
[045b2dc]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 ;;
[877cc6a]385 esac
386 #
387 # First append each name of the script files to a list (this will become
[179ae85]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
[045b2dc]434 #
435 # Grab the name of the target, strip id number and misc words.
436 case $this_script in
[179ae85]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 ;;
[045b2dc]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)
[a160d86]451 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]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.
[045b2dc]459 LUSER_wrt_target "${this_script}" "$PREV"
[877cc6a]460 #
[a160d86]461 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]462 # Insert instructions for unpacking the package and changing directories
463 #
[045b2dc]464 [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
[ce262a7]465 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[877cc6a]466 #
467 # Select a script execution method
[179ae85]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
[877cc6a]506 #
[045b2dc]507 # Housekeeping...remove any build directory(ies) except if the package build fails.
508 [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
[877cc6a]509 #
510 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]511 wrt_touch
[877cc6a]512 #
513 #--------------------------------------------------------------------#
514 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
515 #--------------------------------------------------------------------#
516 #
517 # Keep the script file name for Makefile dependencies.
518 PREV=$this_script
519
[045b2dc]520 done
[877cc6a]521}
522
523
[045b2dc]524#--------------------------------------#
[d55a1a1]525testsuite_tools_Makefiles() { #
[045b2dc]526#--------------------------------------#
[877cc6a]527
[d55a1a1]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}"
[010627d]532 PREV=""
[d55a1a1]533 fi
[877cc6a]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
[a160d86]550 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]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.
[ca6b261]558 CHROOT_wrt_target "${this_script}" "$PREV"
[877cc6a]559 #
[ca6b261]560 CHROOT_Unpack "$pkg_tarball"
[ce262a7]561 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[877cc6a]562 #
[ca6b261]563 CHROOT_wrt_RunAsRoot "${file}"
[877cc6a]564 #
[ca6b261]565 CHROOT_wrt_RemoveBuildDirs "${name}"
[877cc6a]566 #
567 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]568 wrt_touch
[877cc6a]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
[045b2dc]581#--------------------------------------#
[d55a1a1]582final_system_Makefiles() { #
[045b2dc]583#--------------------------------------#
[45f82718]584 # Set envars and scripts for iteration targets
585 if [[ -z "$1" ]] ; then
586 local N=""
[d55a1a1]587 # In boot method the makesys phase was initiated in testsuite_tools_makefile
588 [[ "${METHOD}" = "boot" ]] && [[ "$TEST" = 0 ]] && PREV=""
[45f82718]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}
[10c8b78]599 # Rename the scripts
600 mv ${script} ${script}$N
[45f82718]601 done
[a5f52ba]602 # Remove Bzip2 binaries before make install (CLFS-1.0 compatibility)
[10c8b78]603 sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2$N
[45f82718]604 # Delete *old Readline libraries just after make install
[10c8b78]605 sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline$N
[45f82718]606 fi
607
[d55a1a1]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
[877cc6a]613
[45f82718]614 for file in final-system$N/* ; do
[877cc6a]615 # Keep the script file name
616 this_script=`basename $file`
617
[45f82718]618 # Test if the stripping phase must be skipped.
[4384929]619 # Skip also temp-perl for iterative runs
[877cc6a]620 case $this_script in
[401f81e]621 *stripping*) [[ "$STRIP" = "n" ]] && continue ;;
[45f82718]622 *temp-perl*) [[ -n "$N" ]] && continue ;;
[877cc6a]623 esac
624
[4384929]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@@'`
[877cc6a]636
[45f82718]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
[a160d86]640 pkg_tarball=$(get_package_tarball_name $name)
[9d9ecf7]641
[a160d86]642 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
[45f82718]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
[10c8b78]651 basicsystem="$basicsystem ${this_script}"
[45f82718]652
[877cc6a]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.
[10c8b78]659 CHROOT_wrt_target "${this_script}" "$PREV"
[877cc6a]660
[a160d86]661 # If $pkg_tarball isn't empty, we've got a package...
662 if [ "$pkg_tarball" != "" ] ; then
[f546320]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
[045b2dc]668 CHROOT_Unpack "$pkg_tarball"
[a229600]669 # If the testsuites must be run, initialize the log file
670 case $name in
[269d81c]671 binutils | gcc | glibc | eglibc | gmp | mpfr | mpc | isl | cloog )
[10c8b78]672 [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}"
[a229600]673 ;;
674 * )
[10c8b78]675 [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && CHROOT_wrt_test_log "${this_script}"
[a229600]676 ;;
677 esac
678 # If using optimizations, write the instructions
[1b65a84]679 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[877cc6a]680 fi
681 #
[045b2dc]682 CHROOT_wrt_RunAsRoot "${file}"
[877cc6a]683 #
[f546320]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
[4384929]689 CHROOT_wrt_LogNewFiles "$name1"
[f546320]690 fi
691 fi
[877cc6a]692 #
[f546320]693 # Include a touch of the target name so make can check
694 # if it's already been made.
[93f38e7]695 wrt_touch
[877cc6a]696 #
697 #--------------------------------------------------------------------#
698 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
699 #--------------------------------------------------------------------#
700 #
701 # Keep the script file name for Makefile dependencies.
[10c8b78]702 PREV=${this_script}
[45f82718]703 # Set system_build envar for iteration targets
704 system_build=$basicsystem
[877cc6a]705 done # for file in final-system/* ...
706}
707
[045b2dc]708#--------------------------------------#
[d55a1a1]709bootscripts_Makefiles() { #
[045b2dc]710#--------------------------------------#
[d55a1a1]711
[c6ee8ea]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
[d55a1a1]721 if [[ "${METHOD}" = "chroot" ]]; then
[c6ee8ea]722 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) $config ( CHROOT ) ${R_arrow}"
[45f82718]723 else
[c6ee8ea]724 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) $config ( ROOT ) ${R_arrow}"
[45f82718]725 fi
[877cc6a]726
[c6ee8ea]727 for file in $config/* ; do
[877cc6a]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 *) ;;
735 esac
736
737 # First append each name of the script files to a list (this will become
738 # the names of the targets in the Makefile
739 bootscripttools="$bootscripttools $this_script"
740
[4384929]741 # Grab the name of the target, strip id number, XXX-script.
742 # name1 is partially stripped and should be used for logging files.
743 # name is completely stripped and is used for grabbing
744 # the package name.
745 name1=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
746 name=`echo $name1 | sed -e 's@-64bit@@' \
747 -e 's@-64@@' \
748 -e 's@64@@' \
749 -e 's@n32@@'`
[877cc6a]750 case $name in
[c044e3c]751 *bootscripts*) name=bootscripts-cross-lfs ;;
[877cc6a]752 *udev-rules) name=udev-cross-lfs ;;
753 esac
[c044e3c]754
[a160d86]755 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]756
757 #--------------------------------------------------------------------#
758 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
759 #--------------------------------------------------------------------#
760 #
761 # Drop in the name of the target on a new line, and the previous target
762 # as a dependency. Also call the echo_message function.
[045b2dc]763 CHROOT_wrt_target "${this_script}" "$PREV"
[877cc6a]764 #
[a160d86]765 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]766 #
[f546320]767 if [ "$pkg_tarball" != "" ] ; then
768 if [ "${INSTALL_LOG}" = "y" ] ; then
[4384929]769 CHROOT_wrt_TouchTimestamp
[f546320]770 fi
771 CHROOT_Unpack "$pkg_tarball"
772 fi
[877cc6a]773 #
[045b2dc]774 CHROOT_wrt_RunAsRoot "${file}"
[877cc6a]775 #
[f546320]776 # Write installed files log and remove the build directory(ies)
777 # except if the package build fails.
778 if [ "$pkg_tarball" != "" ] ; then
779 CHROOT_wrt_RemoveBuildDirs "$name"
780 if [ "${INSTALL_LOG}" = "y" ] ; then
[4384929]781 CHROOT_wrt_LogNewFiles "$name1"
[f546320]782 fi
783 fi
[877cc6a]784 #
785 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]786 wrt_touch
[877cc6a]787 #
788 #--------------------------------------------------------------------#
789 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
790 #--------------------------------------------------------------------#
791 #
792 # Keep the script file name for Makefile dependencies.
793 PREV=$this_script
794
795 done # for file in bootscripts/* ...
796}
797
[608fbe1]798#--------------------------------------#
799network_Makefiles() { #
800#--------------------------------------#
801
802 if [[ "${METHOD}" = "chroot" ]]; then
803 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) network ( CHROOT ) ${R_arrow}"
804 else
805 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) network ( ROOT ) ${R_arrow}"
806 fi
807
808 for file in network/* ; do
809 # Keep the script file name
810 this_script=`basename $file`
811
812 case $this_script in
813 *choose) continue ;; # This is not a script but a commentary.
814 *dhcp) continue ;; # Assume static networking.
815 *dhcpcd) continue ;; # Assume static networking.
816 *) ;;
817 esac
818
819 # First append each name of the script files to a list (this will become
820 # the names of the targets in the Makefile
821 networktools="$networktools $this_script"
822
823 # Grab the name of the target, strip id number, XXX-script
[4384929]824 # name1 is partially stripped and should be used for logging files.
825 # name is completely stripped and is used for grabbing
826 # the package name.
827 name1=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
828 name=`echo $name1 | sed -e 's@-64bit@@' \
829 -e 's@-64@@' \
830 -e 's@64@@' \
831 -e 's@n32@@'`
[608fbe1]832 case $name in
[b4df9e1]833 network-scripts) name=clfs-network-scripts ;;
[608fbe1]834 esac
835
836 pkg_tarball=$(get_package_tarball_name $name)
837
838 #--------------------------------------------------------------------#
839 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
840 #--------------------------------------------------------------------#
841 #
842 # Drop in the name of the target on a new line, and the previous target
843 # as a dependency. Also call the echo_message function.
844 CHROOT_wrt_target "${this_script}" "$PREV"
845 #
846 # If $pkg_tarball isn't empty, we've got a package...
847 #
848 if [ "$pkg_tarball" != "" ] ; then
849 if [ "${INSTALL_LOG}" = "y" ] ; then
[4384929]850 CHROOT_wrt_TouchTimestamp
[608fbe1]851 fi
852 CHROOT_Unpack "$pkg_tarball"
853 fi
854 #
855 CHROOT_wrt_RunAsRoot "${file}"
856 #
857 # Write installed files log and remove the build directory(ies)
858 # except if the package build fails.
859 if [ "$pkg_tarball" != "" ] ; then
860 CHROOT_wrt_RemoveBuildDirs "$name"
861 if [ "${INSTALL_LOG}" = "y" ] ; then
[4384929]862 CHROOT_wrt_LogNewFiles "$name1"
[608fbe1]863 fi
864 fi
865 #
866 # Include a touch of the target name so make can check if it's already been made.
867 wrt_touch
868 #
869 #--------------------------------------------------------------------#
870 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
871 #--------------------------------------------------------------------#
872 #
873 # Keep the script file name for Makefile dependencies.
874 PREV=$this_script
875
876 done # for file in network/* ...
877}
878
[045b2dc]879#--------------------------------------#
[d55a1a1]880bootable_Makefiles() { #
[045b2dc]881#--------------------------------------#
[877cc6a]882
[d55a1a1]883 if [[ "${METHOD}" = "chroot" ]]; then
884 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable ( CHROOT ) ${R_arrow}"
885 else
886 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable ( ROOT ) ${R_arrow}"
887 fi
[877cc6a]888
889
[936efa8]890 for file in bootable/* ; do
[877cc6a]891 # Keep the script file name
892 this_script=`basename $file`
893
894 # A little housekeeping on the scripts
895 case $this_script in
896 *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
[045b2dc]897 *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
[877cc6a]898 *kernel) # if there is no kernel config file do not build the kernel
899 [[ -z $CONFIG ]] && continue
900 # Copy the config file to /sources with a standardized name
901 cp $CONFIG $BUILDDIR/sources/kernel-config
902 ;;
903 esac
904 #
905 # First append each name of the script files to a list (this will become
906 # the names of the targets in the Makefile
907 bootabletools="$bootabletools $this_script"
908 #
909 # Grab the name of the target, strip id number and misc words.
910 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
911 case $this_script in
912 *kernel*) name=linux
913 ;;
914 esac
[a160d86]915
916 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]917
918 #--------------------------------------------------------------------#
919 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
920 #--------------------------------------------------------------------#
921 #
922 # Drop in the name of the target on a new line, and the previous target
923 # as a dependency. Also call the echo_message function.
[045b2dc]924 CHROOT_wrt_target "${this_script}" "$PREV"
[877cc6a]925 #
[a160d86]926 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]927 # Insert instructions for unpacking the package and changing directories
928 #
[f546320]929 if [ "$pkg_tarball" != "" ] ; then
930 if [ "${INSTALL_LOG}" = "y" ] ; then
[4384929]931 CHROOT_wrt_TouchTimestamp
[f546320]932 fi
933 CHROOT_Unpack "$pkg_tarball"
934 fi
[877cc6a]935 #
936 # Select a script execution method
937 case $this_script in
[045b2dc]938 *fstab*) if [[ -n "$FSTAB" ]]; then
939 CHROOT_wrt_CopyFstab
940 else
941 CHROOT_wrt_RunAsRoot "${file}"
942 fi
943 ;;
944 *) CHROOT_wrt_RunAsRoot "${file}"
945 ;;
[877cc6a]946 esac
947 #
[f546320]948 # Write installed files log and remove the build directory(ies)
949 # except if the package build fails.
950 if [ "$pkg_tarball" != "" ] ; then
951 CHROOT_wrt_RemoveBuildDirs "$name"
952 if [ "${INSTALL_LOG}" = "y" ] ; then
953 CHROOT_wrt_LogNewFiles "$name"
954 fi
955 fi
[877cc6a]956 #
957 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]958 wrt_touch
[877cc6a]959 #
960 #--------------------------------------------------------------------#
961 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
962 #--------------------------------------------------------------------#
963 #
964 # Keep the script file name for Makefile dependencies.
965 PREV=$this_script
966
967 done
968
969}
970
971
[045b2dc]972#--------------------------------------#
973build_Makefile() { # Construct a Makefile from the book scripts
974#--------------------------------------#
975
976 echo "...Creating Makefile... ${BOLD}START${OFF}"
[877cc6a]977
978 cd $JHALFSDIR/${PROGNAME}-commands
[730436a]979 # Start with clean files
[045b2dc]980 >$MKFILE
[877cc6a]981 >$MKFILE.tmp
982
[d55a1a1]983 method_cmds=${METHOD}_Makefiles
[045b2dc]984
985 host_prep_Makefiles # mk_SETUP (SETUP) $host_prep
[3f83cb0]986 final_preps_Makefiles # mk_F_PREPS (LUSER) $final_preps
[045b2dc]987 cross_tools_Makefiles # mk_CROSS (LUSER) $cross_tools
988 temptools_Makefiles # mk_TEMP (LUSER) $temptools
989 $method_cmds # mk_SYSTOOLS (CHROOT) $chroottools/$boottools
990 if [[ ! $TEST = "0" ]]; then
[d55a1a1]991 testsuite_tools_Makefiles # mk_SYSTOOLS (CHROOT) $testsuitetools
[877cc6a]992 fi
[d55a1a1]993 final_system_Makefiles # mk_FINAL (CHROOT) $basicsystem
[045b2dc]994 # Add the iterations targets, if needed
995 [[ "$COMPARE" = "y" ]] && wrt_compare_targets
[d55a1a1]996 bootscripts_Makefiles # mk_BOOTSCRIPT (CHROOT) $bootscripttools
[608fbe1]997 if [ -d network ]; then
998 network_Makefiles # If present, process network setup.
999 fi
[d55a1a1]1000 bootable_Makefiles # mk_BOOTABLE (CHROOT) $bootabletools
[877cc6a]1001
[3e7ceed]1002 # Add the CUSTOM_TOOLS targets, if needed
1003 [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
[c10570d]1004
[877cc6a]1005 # Add a header, some variables and include the function file
1006 # to the top of the real Makefile.
[195ed9f]1007 wrt_Makefile_header
[877cc6a]1008
1009 # Add chroot commands
1010 if [ "$METHOD" = "chroot" ] ; then
[6ad5a2f]1011 CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
[15c9e72]1012 chroot=`cat chroot/???-chroot | \
[6ad5a2f]1013 sed -e "s@chroot@$CHROOT_LOC@" \
[830f28d]1014 -e '/#!\/bin\/bash/d' \
[6ad5a2f]1015 -e '/^export/d' \
1016 -e '/^logout/d' \
1017 -e 's@ \\\@ @g' | \
1018 tr -d '\n' | \
1019 sed -e 's/ */ /g' \
1020 -e 's|\\$|&&|g' \
1021 -e 's|exit||g' \
1022 -e 's|$| -c|' \
[f4d9a48]1023 -e 's|"$${CLFS}"|$(MOUNT_PT)|'\
[f3a7f3b]1024 -e 's|set -e||' \
1025 -e 's|set +h||'`
[877cc6a]1026 echo -e "CHROOT1= $chroot\n" >> $MKFILE
1027 fi
1028
[045b2dc]1029################## CHROOT ####################
1030
[877cc6a]1031if [[ "${METHOD}" = "chroot" ]]; then
1032(
[045b2dc]1033cat << EOF
[877cc6a]1034
[3f83cb0]1035all: ck_UID mk_SETUP mk_F_PREPS mk_SUDO mk_SYSTOOLS create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL
[045b2dc]1036 @sudo make do-housekeeping
[936efa8]1037 @echo "$VERSION - jhalfs build" > clfs-release && \\
[269d81c]1038 sudo mv clfs-release \$(MOUNT_PT)/etc && \\
1039 sudo chown root:root \$(MOUNT_PT)/etc/clfs-release
[045b2dc]1040 @\$(call echo_finished,$VERSION)
[a160d86]1041
[045b2dc]1042ck_UID:
1043 @if [ \`id -u\` = "0" ]; then \\
1044 echo "+--------------------------------------------------+"; \\
1045 echo "|You cannot run this makefile from the root account|"; \\
1046 echo "+--------------------------------------------------+"; \\
1047 exit 1; \\
1048 fi
1049
1050#---------------AS ROOT
1051mk_SETUP:
1052 @\$(call echo_SU_request)
[7a43320]1053 @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
[045b2dc]1054 @touch \$@
1055
1056#---------------AS LUSER
[3f83cb0]1057mk_F_PREPS: mk_SETUP
1058 @\$(call echo_PHASE,Final Preparations Cross and Temporary Tools)
[730436a]1059 @( \$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) AS_LUSER" )
[045b2dc]1060 @sudo make restore-luser-env
1061 @touch \$@
1062
[3f83cb0]1063mk_SUDO: mk_F_PREPS
[7a43320]1064 @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
[045b2dc]1065 @touch \$@
1066
1067#---------------CHROOT JAIL
1068mk_SYSTOOLS: mk_SUDO
1069 @\$(call echo_CHROOT_request)
1070 @\$(call echo_PHASE, CHROOT JAIL )
[6c1b96b]1071 @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) PREP_CHROOT_JAIL")
[7a43320]1072 @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT_JAIL")
[045b2dc]1073 @touch \$@
[877cc6a]1074
[269d81c]1075mk_BLFS_TOOL: create-sbu_du-report
1076 @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
1077 \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
1078 (sudo \$(CHROOT1) "make -C $BLFS_ROOT/work"); \\
1079 fi;
1080 @touch \$@
1081
1082mk_CUSTOM_TOOLS: mk_BLFS_TOOL
[3e7ceed]1083 @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
[79da297]1084 \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
[3e7ceed]1085 sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
[7a43320]1086 (sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
[3e7ceed]1087 fi;
1088 @touch \$@
1089
[6c1b96b]1090SETUP: $host_prep
[3f83cb0]1091AS_LUSER: $final_preps $cross_tools $temptools
[6c1b96b]1092SUDO: $orphan_scripts
1093PREP_CHROOT_JAIL: SHELL=/tools/bin/bash
1094PREP_CHROOT_JAIL: ${chroottools}
1095CHROOT_JAIL: SHELL=/tools/bin/bash
1096CHROOT_JAIL: $testsuitetools $basicsystem $bootscripttools $bootabletools
1097CUSTOM_TOOLS: $custom_list
[877cc6a]1098
[1838bc7]1099
1100create-sbu_du-report: mk_SYSTOOLS
1101 @\$(call echo_message, Building)
1102 @if [ "\$(ADD_REPORT)" = "y" ]; then \\
1103 ./create-sbu_du-report.sh logs $VERSION; \\
1104 \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
1105 fi;
1106 @touch \$@
1107
[7d9a82d]1108do-housekeeping:
[4524fb2]1109 @-umount \$(MOUNT_PT)/dev/pts
[269d81c]1110 @-if [ -h \$(MOUNT_PT)/dev/shm ]; then \\
1111 link=\$\$(readlink \$(MOUNT_PT)/dev/shm); \\
1112 umount \$(MOUNT_PT)/\$\$link; \\
1113 unset link; \\
1114 else \\
1115 umount \$(MOUNT_PT)/dev/shm; \\
1116 fi
[4524fb2]1117 @-umount \$(MOUNT_PT)/dev
1118 @-umount \$(MOUNT_PT)/sys
1119 @-umount \$(MOUNT_PT)/proc
[045b2dc]1120 @-rm /tools /cross-tools
[6ad5a2f]1121 @-if [ ! -f luser-exist ]; then \\
1122 userdel \$(LUSER); \\
[962793a]1123 rm -rf \$(LUSER_HOME); \\
[7d9a82d]1124 fi;
1125
[877cc6a]1126EOF
1127) >> $MKFILE
[045b2dc]1128
[877cc6a]1129fi
1130
[045b2dc]1131################### BOOT #####################
[877cc6a]1132
1133if [[ "${METHOD}" = "boot" ]]; then
1134(
[045b2dc]1135cat << EOF
[877cc6a]1136
[3f83cb0]1137all: ck_UID mk_SETUP mk_F_PREPS mk_SUDO
[045b2dc]1138 @sudo make restore-luser-env
1139 @sudo make do-housekeeping
[877cc6a]1140 @\$(call echo_boot_finished,$VERSION)
1141
[3e7ceed]1142makesys: mk_FINAL mk_CUSTOM_TOOLS mk_BLFS_TOOL
[936efa8]1143 @echo "$VERSION - jhalfs build" > /etc/clfs-release
[877cc6a]1144 @\$(call echo_finished,$VERSION)
1145
1146
[045b2dc]1147ck_UID:
1148 @if [ \`id -u\` = "0" ]; then \\
1149 echo "+--------------------------------------------------+"; \\
1150 echo "|You cannot run this makefile from the root account|"; \\
1151 echo "|However, if this is the boot environment |"; \\
1152 echo "| the command you are looking for is |"; \\
1153 echo "| make makesys |"; \\
[730436a]1154 echo "| to complete the build |"; \\
[045b2dc]1155 echo "+--------------------------------------------------+"; \\
1156 exit 1; \\
1157 fi
[877cc6a]1158
[045b2dc]1159#---------------AS ROOT
[877cc6a]1160
[045b2dc]1161mk_SETUP:
1162 @\$(call echo_SU_request)
[7a43320]1163 @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
[045b2dc]1164 @touch \$@
1165
1166#---------------AS LUSER
[a160d86]1167
[3f83cb0]1168mk_F_PREPS: mk_SETUP
1169 @\$(call echo_PHASE,Final Preparations and Cross Tools)
[730436a]1170 @( \$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) AS_LUSER" )
[045b2dc]1171 @touch \$@
1172
[3f83cb0]1173mk_SUDO: mk_F_PREPS
[7a43320]1174 @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
[045b2dc]1175 @touch \$@
1176
1177#---------------AS ROOT
1178
1179mk_FINAL:
1180 @\$(call echo_PHASE,Final System)
[7a43320]1181 @( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) AS_ROOT )
[045b2dc]1182 @touch \$@
1183
[269d81c]1184mk_BLFS_TOOL: mk_FINAL
[e18f80a]1185 @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
1186 \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
1187 ( make -C $BLFS_ROOT/work ); \\
1188 fi;
1189 @touch \$@
[269d81c]1190
1191mk_CUSTOM_TOOLS: mk_BLFS_TOOL
[3e7ceed]1192 @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
[79da297]1193 \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
[3bc6078]1194 mkdir -p ${TRACKING_DIR}; \\
[7a43320]1195 ( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS ); \\
[3e7ceed]1196 fi;
1197 @touch \$@
1198
1199SETUP: $host_prep
[3f83cb0]1200AS_LUSER: $final_preps $cross_tools $temptools ${boottools}
[3e7ceed]1201SUDO: $orphan_scripts
[aec4483]1202AS_ROOT: SHELL=/tools/bin/bash
[3e7ceed]1203AS_ROOT: $testsuitetools $basicsystem $bootscripttools $bootabletools
1204CUSTOM_TOOLS: $custom_list
[045b2dc]1205
1206do-housekeeping:
1207 @-rm /tools /cross-tools
1208 @-if [ ! -f luser-exist ]; then \\
[6ad5a2f]1209 userdel \$(LUSER); \\
[962793a]1210 rm -rf \$(LUSER_HOME); \\
[877cc6a]1211 fi;
1212
[045b2dc]1213EOF
1214) >> $MKFILE
1215fi
1216
1217(
1218 cat << EOF
1219
[6ad5a2f]1220restore-luser-env:
[877cc6a]1221 @\$(call echo_message, Building)
[962793a]1222 @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
1223 mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
[877cc6a]1224 fi;
[962793a]1225 @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
1226 mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
[877cc6a]1227 fi;
[962793a]1228 @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
[93f38e7]1229 touch \$@ && \\
1230 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
1231 echo --------------------------------------------------------------------------------\$(WHITE)
[877cc6a]1232
[045b2dc]1233########################################################
1234
[7d9a82d]1235
[877cc6a]1236EOF
1237) >> $MKFILE
1238
1239 # Bring over the items from the Makefile.tmp
1240 cat $MKFILE.tmp >> $MKFILE
1241 rm $MKFILE.tmp
1242
[045b2dc]1243 echo "Creating Makefile... ${BOLD}DONE${OFF}"
[877cc6a]1244}
Note: See TracBrowser for help on using the repository browser.