source: HLFS/master.sh@ cbe3f2b

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

Remove dead code. Add compare test code to butterfly-toolchain

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