source: CLFS/master.sh@ 14c9622

experimental
Last change on this file since 14c9622 was 9485eba, checked in by George Boudreau <georgeb@…>, 18 years ago

Implement suggestion made byDan Nicholson for configurable user/group. Required many changes and allowed for the removal of user specific function calls. Tnx Dan

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