source: HLFS/master.sh@ d0249fc

experimental
Last change on this file since d0249fc was a82bbc0, checked in by George Boudreau <georgeb@…>, 18 years ago

Moved some toolchain code to xsl script, clearer method

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