source: HLFS/master.sh@ 120bcdd

1.0 2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 120bcdd was a160d86, checked in by George Boudreau <georgeb@…>, 18 years ago

Extensive code changes. A different method for finding the tarball name.

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