source: HLFS/master.sh@ c483858

experimental
Last change on this file since c483858 was c483858, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Added ICA/farce support to HLFS module.

  • Property mode set to 100755
File size: 20.2 KB
RevLine 
[0170229]1#!/bin/sh
2set -e # Enable error trapping
3
[57ca090]4# $Id$
[0170229]5
6###################################
7### FUNCTIONS ###
8###################################
9
10
11#----------------------------#
12get_sources() { #
13#----------------------------#
14 local IFS
15
16 # Test if the packages must be downloaded
17 if [ ! "$HPKG" = "1" ] ; then
18 return
19 fi
20
21 # Modify the 'internal field separator' to break on 'LF' only
22 IFS=$'\x0A'
23
24 if [ ! -d $BUILDDIR/sources ] ; then mkdir $BUILDDIR/sources ; fi
25 cd $BUILDDIR/sources
26
27 > MISSING_FILES.DMP # Files not in md5sum end up here
28
29 if [ -f MD5SUMS ] ; then rm MD5SUMS ; fi
30 if [ -f MD5SUMS-$VERSION ] ; then rm MD5SUMS-$VERSION ; fi
31
32 # Retrieve the master md5sum file
33 download "" MD5SUMS
34
35 # Iterate through each package and grab it, along with any patches it needs.
36 for i in `cat $JHALFSDIR/packages` ; do
37 PKG=`echo $i | sed -e 's/-version.*//' \
38 -e 's/uclibc/uClibc/' `
39
40 #
41 # How to deal with orphan packages..??
42 #
43 VRS=`echo $i | sed -e 's/.* //' -e 's/"//g'`
44 case "$PKG" in
[c940100]45 "gcc" )
46 download $PKG "gcc-core-$VRS.tar.bz2"
47 download $PKG "gcc-g++-$VRS.tar.bz2"
48 if [ ! "$TEST" = "0" ] ; then
49 download $PKG "gcc-testsuite-$VRS.tar.bz2" ;
50 fi
51 ;;
[0170229]52
[c940100]53 "glibc")
54 if [ "$MODEL" = "glibc" ] ; then
55 download $PKG "$PKG-$VRS.tar.bz2"
56 download $PKG "$PKG-libidn-$VRS.tar.bz2"
57 fi
58 ;;
[0170229]59
[c940100]60 "tcl" )
61 FILE="$PKG$VRS-src.tar.bz2" ; download $PKG $FILE ;;
[0170229]62
[c940100]63 "uclibc" )
64 if [ "$MODEL" = "uclibc" ] ; then
65 download $PKG "$PKG-$VRS.tar.bz2"
66 fi
[0170229]67 ;;
[c940100]68
69 "uClibc-locale" )
70 if [ "$MODEL" = "uclibc" ] ; then
71 FILE="$PKG-$VRS.tgz" ; PKG="uClibc"
72 download $PKG $FILE
73 # There can be no patches for this file
74 continue
75 fi
[0170229]76 ;;
[c940100]77
78 "uClibc-patch" ) continue ;;
79
80 * )
81 FILE="$PKG-$VRS.tar.bz2" ; download $PKG $FILE ;;
[0170229]82 esac
83
84 for patch in `grep "$PKG-&$PKG" $JHALFSDIR/patches` ; do
85 PATCH=`echo $patch | sed 's@&'$PKG'-version;@'$VRS'@'`
86 download $PKG $PATCH
87 done
88
89 done
90
91 # .... U G L Y .... what to do with the grsecurity patch to the kernel..
92 download grsecurity `grep grsecurity $JHALFSDIR/patches`
93
94 if [[ -s $BUILDDIR/sources/MISSING_FILES.DMP ]]; then
95 echo -e "\n\n${tab_}${RED} One or more files were not retrieved.\n${tab_} Check <MISSING_FILES.DMP> for names ${OFF}\n\n"
96 fi
97}
98
99
100#----------------------------#
[389fe2a]101chapter3_Makefiles() { # Initialization of the system
[0170229]102#----------------------------#
103 local TARGET LOADER
104
[e10232b]105 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter3${R_arrow}"
[0170229]106
107 # Define a few model dependant variables
108 if [[ ${MODEL} = "uclibc" ]]; then
109 TARGET="tools-linux-uclibc"; LOADER="ld-uClibc.so.0"
110 else
111 TARGET="tools-linux-gnu"; LOADER="ld-linux.so.2"
[5c5a010]112 fi
[0170229]113
[5c5a010]114 # NOTE: We use the lfs username and groupname also in HLFS
115 # If /home/lfs is already present in the host, we asume that the
116 # lfs user and group are also presents in the host, and a backup
[0170229]117 # of their bash init files is made.
118(
119cat << EOF
120020-creatingtoolsdir:
121 @\$(call echo_message, Building)
122 @mkdir -v \$(MOUNT_PT)/tools && \\
123 rm -fv /tools && \\
124 ln -sv \$(MOUNT_PT)/tools /
125 @if [ ! -d \$(MOUNT_PT)/sources ]; then \\
126 mkdir \$(MOUNT_PT)/sources; \\
127 fi;
128 @chmod a+wt \$(MOUNT_PT)/sources && \\
129 touch \$@
130
131021-addinguser: 020-creatingtoolsdir
132 @\$(call echo_message, Building)
133 @if [ ! -d /home/lfs ]; then \\
134 groupadd lfs; \\
135 useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\
136 else \\
137 touch user-lfs-exist; \\
138 fi;
139 @chown lfs \$(MOUNT_PT)/tools && \\
140 chown lfs \$(MOUNT_PT)/sources && \\
141 touch \$@
142
143022-settingenvironment: 021-addinguser
144 @\$(call echo_message, Building)
145 @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\
146 mv -v /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\
147 fi;
148 @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\
149 mv -v /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\
150 fi;
151 @echo "set +h" > /home/lfs/.bashrc && \\
152 echo "umask 022" >> /home/lfs/.bashrc && \\
153 echo "HLFS=\$(MOUNT_PT)" >> /home/lfs/.bashrc && \\
154 echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
155 echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
156 echo "export HLFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
157 echo "" >> /home/lfs/.bashrc && \\
158 echo "target=$(uname -m)-${TARGET}" >> /home/lfs/.bashrc && \\
159 echo "ldso=/tools/lib/${LOADER}" >> /home/lfs/.bashrc && \\
160 echo "export target ldso" >> /home/lfs/.bashrc && \\
161 echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc && \\
162 chown lfs:lfs /home/lfs/.bashrc && \\
163 touch envars && \\
164 touch \$@
165EOF
166) >> $MKFILE.tmp
167
168}
169
170#----------------------------#
171chapter5_Makefiles() { # Bootstrap or temptools phase
172#----------------------------#
173 local file
174 local this_script
[57ca090]175
[e10232b]176 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5${R_arrow}"
[0170229]177
178 for file in chapter05/* ; do
179 # Keep the script file name
180 this_script=`basename $file`
181
182 # Skip this script depending on jhalfs.conf flags set.
183 case $this_script in
184 # If no testsuites will be run, then TCL, Expect and DejaGNU aren't needed
[821a2c6]185 *tcl* ) [[ "$TEST" = "0" ]] && continue; ;;
186 *expect* ) [[ "$TEST" = "0" ]] && continue; ;;
187 *dejagnu* ) [[ "$TEST" = "0" ]] && continue; ;;
[7d018d1]188 # Nothing interestin in this script
189 *introduction* ) continue ;;
[0170229]190 # Test if the stripping phase must be skipped
191 *stripping* ) [[ "$STRIP" = "0" ]] && continue ;;
192 *) ;;
193 esac
194
195 # First append each name of the script files to a list (this will become
196 # the names of the targets in the Makefile
197 chapter5="$chapter5 $this_script"
198
199 # Grab the name of the target (minus the -headers or -cross in the case of gcc
200 # and binutils in chapter 5)
201 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-cross@@' -e 's@-headers@@'`
202
[5c5a010]203 # Adjust 'name'
[0170229]204 case $name in
[5c5a010]205 linux-libc) name=linux-libc-headers ;;
[0170229]206 esac
207
208 # Set the dependency for the first target.
209 if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
210
211
212 #--------------------------------------------------------------------#
213 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
214 #--------------------------------------------------------------------#
215 #
216 # Drop in the name of the target on a new line, and the previous target
217 # as a dependency. Also call the echo_message function.
218 wrt_target "$this_script" "$PREV"
219
220 # Find the version of the command files, if it corresponds with the building of
221 # a specific package
222 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
223 # If $vrs isn't empty, we've got a package...
224 if [ "$vrs" != "" ] ; then
225 # Deal with non-standard names
226 case $name in
[c3c4e1d]227 tcl) FILE="$name$vrs-src.tar.*" ;;
228 uclibc) FILE="uClibc-$vrs.tar.*" ;;
229 gcc) FILE="gcc-core-$vrs.tar.*" ;;
230 *) FILE="$name-$vrs.tar.*" ;;
[0170229]231 esac
232 # Insert instructions for unpacking the package and to set the PKGDIR variable.
233 wrt_unpack "$FILE"
234 fi
235
236 case $this_script in
237 *binutils* ) # Dump the path to sources directory for later removal
[2fbc503]238(
239cat << EOF
240 @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
241 echo "\$(MOUNT_PT)\$(SRC)/\$\$ROOT" >> sources-dir
242EOF
243) >> $MKFILE.tmp
[0170229]244 ;;
245 *adjusting* ) # For the Adjusting phase we must to cd to the binutils-build directory.
246 echo -e '\t@echo "export PKGDIR=$(MOUNT_PT)$(SRC)/binutils-build" > envars' >> $MKFILE.tmp
247 ;;
248 esac
249
250 # Insert date and disk usage at the top of the log file, the script run
251 # and date and disk usage again at the bottom of the log file.
252 wrt_run_as_su "${this_script}" "${file}"
253
254 # Remove the build directory(ies) except if the package build fails
255 # (so we can review config.cache, config.log, etc.)
256 # For Binutils the sources must be retained for some time.
257 if [ "$vrs" != "" ] ; then
[5f4d08f]258 case "${this_script}" in
259 *binutils*) : # do NOTHING
260 ;;
261 *) wrt_remove_build_dirs "$name"
262 ;;
263 esac
[0170229]264 fi
265
266 # Remove the Binutils pass 1 sources after a successful Adjusting phase.
[5f4d08f]267 case "${this_script}" in
268 *adjusting*)
[0170229]269(
270cat << EOF
271 @rm -r \`cat sources-dir\` && \\
272 rm -r \$(MOUNT_PT)\$(SRC)/binutils-build && \\
273 rm sources-dir
274EOF
275) >> $MKFILE.tmp
[5f4d08f]276 ;;
277 esac
[0170229]278
279 # Include a touch of the target name so make can check if it's already been made.
280 echo -e '\t@touch $@' >> $MKFILE.tmp
281 #
282 #--------------------------------------------------------------------#
283 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
284 #--------------------------------------------------------------------#
285
286 # Keep the script file name for Makefile dependencies.
287 PREV=$this_script
288 done # end for file in chapter05/*
289}
290
291
292#----------------------------#
293chapter6_Makefiles() { # sysroot or chroot build phase
294#----------------------------#
295 local TARGET LOADER
296 local file
297 local this_script
[c483858]298 # Set envars and scripts for iteration targets
299 LOGS="" # Start with an empty global LOGS envar
300 if [[ -z "$1" ]] ; then
301 local N=""
302 else
303 local N=-build_$1
304 local chapter6=""
305 mkdir chapter06$N
306 cp chapter06/* chapter06$N
307 for script in chapter06$N/* ; do
308 # Overwrite existing symlinks, files, and dirs
309 sed -e 's/ln -s /ln -sf /g' \
310 -e 's/^mv /&-f/g' -i ${script}
311 done
312 # Remove Bzip2 binaries before make install
313 sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2
314 # Fix how Module-Init-Tools do the install target
315 sed -e 's@make install@make INSTALL=install install@' -i chapter06$N/*-module-init-tools
316 # Delete *old Readline libraries just after make install
317 sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i chapter06$N/*-readline
318 # Don't readd already existing groups
319 sed -e '/groupadd/d' -i chapter06$N/*-udev
320 fi
[0170229]321
[c483858]322 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N${R_arrow}"
[0170229]323 #
324 # Set these definitions early and only once
325 #
326 if [[ ${MODEL} = "uclibc" ]]; then
327 TARGET="pc-linux-uclibc"; LOADER="ld-uClibc.so.0"
328 else
329 TARGET="pc-linux-gnu"; LOADER="ld-linux.so.2"
330 fi
331
[c483858]332 for file in chapter06$N/* ; do
[0170229]333 # Keep the script file name
334 this_script=`basename $file`
335
336 # Skip this script depending on jhalfs.conf flags set.
337 case $this_script in
338 # We'll run the chroot commands differently than the others, so skip them in the
339 # dependencies and target creation.
340 *chroot* ) continue ;;
341 # Test if the stripping phase must be skipped
342 *-stripping* ) [[ "$STRIP" = "0" ]] && continue ;;
343 esac
344
345 # Grab the name of the target
346 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
347
[c483858]348 # Find the version of the command files, if it corresponds with the building of
349 # a specific package
350 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
351
352 if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
353 case "${this_script}" in
354 *stripping*) ;;
355 *) continue ;;
356 esac
357 fi
358
359 # Append each name of the script files to a list (this will become
360 # the names of the targets in the Makefile
361 chapter6="$chapter6 ${this_script}${N}"
362
363 # Append each name of the script files to a list (this will become
364 # the names of the targets in the Makefile)
365 chapter6="$chapter6 ${this_script}${N}"
366
[0170229]367 #
[582feec]368 # Sed replacement to fix some rm command that could fail.
369 # That should be fixed in the book sources.
[0170229]370 #
371 case $name in
[582feec]372 glibc)
[c483858]373 sed 's/rm /rm -f /' -i chapter06$N/$this_script
[0170229]374 ;;
[582feec]375 gcc)
[c483858]376 sed 's/rm /rm -f /' -i chapter06$N/$this_script
[0170229]377 ;;
378 esac
379
380 #--------------------------------------------------------------------#
381 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
382 #--------------------------------------------------------------------#
383 #
384 # Drop in the name of the target on a new line, and the previous target
385 # as a dependency. Also call the echo_message function.
[c483858]386 wrt_target "${this_script}${N}" "$PREV"
[0170229]387
388 # If $vrs isn't empty, we've got a package...
389 # Insert instructions for unpacking the package and changing directories
390 if [ "$vrs" != "" ] ; then
391 # Deal with non-standard names
392 case $name in
393 tcl) FILE="$name$vrs-src.tar.*" ;;
394 uclibc) FILE="uClibc-$vrs.tar.*" ;;
395 gcc) FILE="gcc-core-$vrs.tar.*" ;;
396 *) FILE="$name-$vrs.tar.*" ;;
397 esac
398 wrt_unpack2 "$FILE"
399 wrt_target_vars
400 fi
401
402 case $this_script in
403 *readjusting*) # For the Re-Adjusting phase we must to cd to the binutils-build directory.
404 echo -e '\t@echo "export PKGDIR=$(SRC)/binutils-build" > envars' >> $MKFILE.tmp
405 ;;
406 esac
407
[582feec]408 # In the mount of kernel filesystems we need to set LFS and not to use chroot.
[5f4d08f]409 case "${this_script}" in
410 *kernfs*)
411 wrt_run_as_root "${this_script}" "${file}"
412 ;;
413 *) # The rest of Chapter06
414 wrt_run_as_chroot1 "${this_script}" "${file}"
415 ;;
416 esac
[0170229]417 #
418 # Remove the build directory(ies) except if the package build fails.
419 if [ "$vrs" != "" ] ; then
420 wrt_remove_build_dirs "$name"
421 fi
422 #
423 # Remove the Binutils pass 2 sources after a successful Re-Adjusting phase.
[5f4d08f]424 case "${this_script}" in
425 *readjusting*)
[0170229]426(
427cat << EOF
428 @rm -r \`cat sources-dir\` && \\
429 rm -r \$(MOUNT_PT)\$(SRC)/binutils-build && \\
430 rm sources-dir
431EOF
432) >> $MKFILE.tmp
[5f4d08f]433 ;;
434 esac
[0170229]435
436 # Include a touch of the target name so make can check if it's already been made.
437 echo -e '\t@touch $@' >> $MKFILE.tmp
438 #
439 #--------------------------------------------------------------------#
440 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
441 #--------------------------------------------------------------------#
442
443 # Keep the script file name for Makefile dependencies.
[c483858]444 PREV=${this_script}${N}
445 # Set system_build envar for iteration targets
446 system_build=$chapter6
[0170229]447 done # end for file in chapter06/*
448
449}
450
451#----------------------------#
452chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..etc
453#----------------------------#
454 local file
455 local this_script
[57ca090]456
[e10232b]457 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7${R_arrow}"
[0170229]458 for file in chapter07/*; do
459 # Keep the script file name
460 this_script=`basename $file`
461
462 # Grub must be configured manually.
463 # The filesystems can't be unmounted via Makefile and the user
464 # should enter the chroot environment to create the root
465 # password, edit several files and setup Grub.
466 case $this_script in
[0ac273e]467 *usage) continue ;; # Contains example commands
[0170229]468 *grub) continue ;;
469 *reboot) continue ;;
470 *console) continue ;; # Use the file generated by lfs-bootscripts
471
[57ca090]472 *kernel)
[821a2c6]473 # If no .config file is supplied, the kernel build is skipped
474 [[ -z $CONFIG ]] && continue
[1d756b0]475 cp $CONFIG $BUILDDIR/sources/kernel-config
[0170229]476 ;;
477 esac
478
479 # First append then name of the script file to a list (this will become
480 # the names of the targets in the Makefile
481 chapter7="$chapter7 $this_script"
482
483 #--------------------------------------------------------------------#
484 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
485 #--------------------------------------------------------------------#
486 #
487 # Drop in the name of the target on a new line, and the previous target
488 # as a dependency. Also call the echo_message function.
489 wrt_target "$this_script" "$PREV"
490
[5f4d08f]491 case "${this_script}" in
[db187c74]492 *bootscripts*)
[5f4d08f]493 vrs=`grep "^lfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
494 FILE="lfs-bootscripts-$vrs.tar.*"
495 wrt_unpack2 "$FILE"
496 vrs=`grep "^blfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
497 echo -e "\t@echo \"\$(MOUNT_PT)\$(SRC)/blfs-bootscripts-$vrs\" >> sources-dir" >> $MKFILE.tmp
498 ;;
499 esac
[0170229]500
[db187c74]501 case "${this_script}" in
[5f4d08f]502 *fstab*) # Check if we have a real /etc/fstab file
503 if [[ -n "$FSTAB" ]] ; then
504 wrt_copy_fstab "$this_script"
505 else # Initialize the log and run the script
506 wrt_run_as_chroot2 "${this_script}" "${file}"
507 fi
508 ;;
509 *) # All other scripts
510 wrt_run_as_chroot2 "${this_script}" "${file}"
511 ;;
512 esac
[0170229]513
514 # Remove the build directory except if the package build fails.
[5f4d08f]515 case "${this_script}" in
516 *bootscripts*)
[0170229]517(
518cat << EOF
519 @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
520 rm -r \$(MOUNT_PT)\$(SRC)/\$\$ROOT
521 @rm -r \`cat sources-dir\` && \\
522 rm sources-dir
523EOF
524) >> $MKFILE.tmp
[5f4d08f]525 ;;
526 esac
[0170229]527
528 # Include a touch of the target name so make can check if it's already been made.
529 echo -e '\t@touch $@' >> $MKFILE.tmp
530 #
531 #--------------------------------------------------------------------#
532 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
533 #--------------------------------------------------------------------#
534
535 # Keep the script file name for Makefile dependencies.
536 PREV=$this_script
537 done # for file in chapter07/*
[9e4b9a1]538
539 # Add SBU-disk_usage report target if required
540 if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi
[0170229]541}
542
543
544#----------------------------#
545build_Makefile() { # Construct a Makefile from the book scripts
546#----------------------------#
[e10232b]547 echo "Creating Makefile... "
[0170229]548
549 cd $JHALFSDIR/${PROGNAME}-commands
550 # Start with a clean Makefile.tmp file
551 >$MKFILE.tmp
552
[389fe2a]553 chapter3_Makefiles
[0170229]554 chapter5_Makefiles
555 chapter6_Makefiles
[c483858]556 # Add the iterations targets, if needed
557 [[ "$COMPARE" != "0" ]] && wrt_compare_targets
[0170229]558 chapter7_Makefiles
559
560 # Add a header, some variables and include the function file
561 # to the top of the real Makefile.
562(
563 cat << EOF
564$HEADER
565
566SRC= /sources
567MOUNT_PT= $BUILDDIR
568
569include makefile-functions
570
571EOF
572) > $MKFILE
573
574
575 # Add chroot commands
576 i=1
577 for file in chapter06/*chroot* ; do
578 chroot=`cat $file | sed -e '/#!\/bin\/sh/d' \
579 -e '/^export/d' \
580 -e '/^logout/d' \
581 -e 's@ \\\@ @g' | tr -d '\n' | sed -e 's/ */ /g' \
582 -e 's|\\$|&&|g' \
583 -e 's|exit||g' \
584 -e 's|$| -c|' \
585 -e 's|"$$HLFS"|$(MOUNT_PT)|'\
586 -e 's|set -e||'`
587 echo -e "CHROOT$i= $chroot\n" >> $MKFILE
588 i=`expr $i + 1`
589 done
590
591 # Drop in the main target 'all:' and the chapter targets with each sub-target
592 # as a dependency.
593(
594 cat << EOF
[0ac273e]595all: chapter3 chapter5 chapter6 chapter7
[0170229]596 @\$(call echo_finished,$VERSION)
597
[0ac273e]598chapter3: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
[0170229]599
[0ac273e]600chapter5: chapter3 $chapter5 restore-lfs-env
[0170229]601
602chapter6: chapter5 $chapter6
603
604chapter7: chapter6 $chapter7
605
606clean-all: clean
[bc097cd]607 rm -rf ./{hlfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
[0170229]608
[0ac273e]609clean: clean-chapter7 clean-chapter6 clean-chapter5 clean-chapter3
[0170229]610
[0ac273e]611clean-chapter3:
612 -if [ ! -f user-lfs-exist ]; then \\
613 userdel lfs; \\
614 rm -rf /home/lfs; \\
[0170229]615 fi;
616 rm -rf \$(MOUNT_PT)/tools
617 rm -f /tools
[0ac273e]618 rm -f envars user-lfs-exist
[0170229]619 rm -f 02* logs/02*.log
620
621clean-chapter5:
622 rm -rf \$(MOUNT_PT)/tools/*
[0ac273e]623 rm -f $chapter5 restore-lfs-env sources-dir
[0170229]624 cd logs && rm -f $chapter5 && cd ..
625
626clean-chapter6:
627 -umount \$(MOUNT_PT)/sys
628 -umount \$(MOUNT_PT)/proc
629 -umount \$(MOUNT_PT)/dev/shm
630 -umount \$(MOUNT_PT)/dev/pts
631 -umount \$(MOUNT_PT)/dev
632 rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
633 rm -f $chapter6
634 cd logs && rm -f $chapter6 && cd ..
635
636clean-chapter7:
637 rm -f $chapter7
638 cd logs && rm -f $chapter7 && cd ..
639
[0ac273e]640restore-lfs-env:
[0170229]641 @\$(call echo_message, Building)
642 @if [ -f /home/lfs/.bashrc.XXX ]; then \\
[7d018d1]643 mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
[0170229]644 fi;
[7d018d1]645 @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
646 mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
[0170229]647 fi;
648 @chown lfs:lfs /home/lfs/.bash* && \\
649 touch \$@
650
651EOF
652) >> $MKFILE
653
654 # Bring over the items from the Makefile.tmp
655 cat $MKFILE.tmp >> $MKFILE
656 rm $MKFILE.tmp
[e10232b]657 echo "done"
[0170229]658}
Note: See TracBrowser for help on using the repository browser.