source: CLFS/master.sh@ b4df9e1

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

Add network scripts for CLFS systemd branch

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