source: HLFS/master.sh@ 1e69324

2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 1e69324 was 1e69324, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

HLFS fixes: remove existing toolchain dirs due failed builds and fix the wrt_test_log2 test.

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