source: HLFS/master.sh@ b33a57b

experimental
Last change on this file since b33a57b was 89ddac0, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Ported r2879 from trunk.

  • Property mode set to 100755
File size: 20.6 KB
RevLine 
[0170229]1#!/bin/sh
2set -e # Enable error trapping
3
[57ca090]4# $Id$
[0170229]5
6###################################
7### FUNCTIONS ###
8###################################
9
[65a2be6]10#----------------------------#
11process_toolchain() { # embryo,cocoon and butterfly need special handling
12#----------------------------#
13 local toolchain=$1
14 local this_script=$2
15 local tc_phase
16
17 echo "${tab_}${tab_}${GREEN}toolchain ${L_arrow}${toolchain}${R_arrow}"
18
[89ddac0]19 #
20 # Safe method to remove existing toolchain dirs
21 pkg_tarball=$(get_package_tarball_name "binutils")
22 wrt_remove_existing_dirs "$pkg_tarball"
23 pkg_tarball=$(get_package_tarball_name "gcc-core")
24 wrt_remove_existing_dirs "$pkg_tarball"
25 #
26 # Manually remove the toolchain directories..
27 tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'`
28(
29cat << EOF
30 @rm -rf \$(MOUNT_PT)\$(SRC)/${tc_phase}-toolchain && \\
31 rm -rf \$(MOUNT_PT)\$(SRC)/${tc_phase}-build
32EOF
33) >> $MKFILE.tmp
34
[21dab83]35 case ${toolchain} in
36 *butterfly*)
37(
38cat << EOF
39 @echo "export PKGDIR=\$(SRC)" > envars
40EOF
41) >> $MKFILE.tmp
[89ddac0]42 [[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
[21dab83]43 wrt_run_as_chroot1 "$toolchain" "$this_script"
44 ;;
[a82bbc0]45
[21dab83]46 *)
[65a2be6]47(
48cat << EOF
49 @echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)" > envars
50EOF
51) >> $MKFILE.tmp
[9485eba]52 wrt_RunAsUser "$toolchain" "$this_script"
[21dab83]53 ;;
54 esac
[a82bbc0]55 #
[9485eba]56 # Safe method to remove packages unpacked while inside the toolchain script
[65a2be6]57 pkg_tarball=$(get_package_tarball_name "binutils")
58 wrt_remove_existing_dirs "$pkg_tarball"
59 pkg_tarball=$(get_package_tarball_name "gcc-core")
60 wrt_remove_existing_dirs "$pkg_tarball"
[21dab83]61 #
[65a2be6]62 # Manually remove the toolchain directories..
63 tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'`
64(
65cat << EOF
66 @rm -r \$(MOUNT_PT)\$(SRC)/${tc_phase}-toolchain && \\
67 rm -r \$(MOUNT_PT)\$(SRC)/${tc_phase}-build
68EOF
69) >> $MKFILE.tmp
70
71}
72
[0170229]73
74#----------------------------#
[389fe2a]75chapter3_Makefiles() { # Initialization of the system
[0170229]76#----------------------------#
77
[e10232b]78 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter3${R_arrow}"
[0170229]79
[e840d27]80 # Define a few model dependant variables
81 if [[ ${MODEL} = "uclibc" ]]; then
82 TARGET="pc-linux-gnu"; LOADER="ld-uClibc.so.0"
83 else
84 TARGET="pc-linux-gnu"; LOADER="ld-linux.so.2"
85 fi
[0170229]86
[65a2be6]87 # If /home/hlfs is already present in the host, we asume that the
88 # hlfs user and group are also presents in the host, and a backup
[0170229]89 # of their bash init files is made.
90(
91cat << EOF
92020-creatingtoolsdir:
93 @\$(call echo_message, Building)
[9199a13]94 @mkdir \$(MOUNT_PT)/tools && \\
95 rm -f /tools && \\
96 ln -s \$(MOUNT_PT)/tools /
[0170229]97 @if [ ! -d \$(MOUNT_PT)/sources ]; then \\
98 mkdir \$(MOUNT_PT)/sources; \\
99 fi;
100 @chmod a+wt \$(MOUNT_PT)/sources && \\
[9199a13]101 touch \$@ && \\
102 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
103 echo --------------------------------------------------------------------------------\$(WHITE)
[0170229]104
105021-addinguser: 020-creatingtoolsdir
106 @\$(call echo_message, Building)
[9485eba]107 @if [ ! -d /home/\$(LUSER) ]; then \\
108 groupadd \$(LGROUP); \\
109 useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
[0170229]110 else \\
[65a2be6]111 touch user-hlfs-exist; \\
[0170229]112 fi;
[9485eba]113 @chown \$(LUSER) \$(MOUNT_PT)/tools && \\
114 chown \$(LUSER) \$(MOUNT_PT)/sources && \\
[9199a13]115 touch \$@ && \\
116 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
117 echo --------------------------------------------------------------------------------\$(WHITE)
[0170229]118
119022-settingenvironment: 021-addinguser
120 @\$(call echo_message, Building)
[9485eba]121 @if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
122 mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
[0170229]123 fi;
[9485eba]124 @if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
125 mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
[0170229]126 fi;
[9485eba]127 @echo "set +h" > /home/\$(LUSER)/.bashrc && \\
128 echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
129 echo "HLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
130 echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
131 echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
132 echo "export HLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
133 echo "" >> /home/\$(LUSER)/.bashrc && \\
134 echo "target=$(uname -m)-${TARGET}" >> /home/\$(LUSER)/.bashrc && \\
135 echo "ldso=/tools/lib/${LOADER}" >> /home/\$(LUSER)/.bashrc && \\
136 echo "export target ldso" >> /home/\$(LUSER)/.bashrc && \\
137 echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\
138 chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
[0170229]139 touch envars && \\
[9199a13]140 touch \$@ && \\
141 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
142 echo --------------------------------------------------------------------------------\$(WHITE)
[0170229]143EOF
144) >> $MKFILE.tmp
145
146}
147
148#----------------------------#
149chapter5_Makefiles() { # Bootstrap or temptools phase
150#----------------------------#
151 local file
152 local this_script
[57ca090]153
[e10232b]154 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5${R_arrow}"
[0170229]155
156 for file in chapter05/* ; do
157 # Keep the script file name
158 this_script=`basename $file`
159
160 # Skip this script depending on jhalfs.conf flags set.
161 case $this_script in
162 # If no testsuites will be run, then TCL, Expect and DejaGNU aren't needed
[821a2c6]163 *tcl* ) [[ "$TEST" = "0" ]] && continue; ;;
164 *expect* ) [[ "$TEST" = "0" ]] && continue; ;;
165 *dejagnu* ) [[ "$TEST" = "0" ]] && continue; ;;
[7d018d1]166 # Nothing interestin in this script
167 *introduction* ) continue ;;
[0170229]168 # Test if the stripping phase must be skipped
169 *stripping* ) [[ "$STRIP" = "0" ]] && continue ;;
170 *) ;;
171 esac
172
173 # First append each name of the script files to a list (this will become
174 # the names of the targets in the Makefile
175 chapter5="$chapter5 $this_script"
176
[9272545]177 # Grab the name of the target
178 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
[0170229]179
[5c5a010]180 # Adjust 'name'
[0170229]181 case $name in
[3b63c8c]182 uclibc) name="uClibc" ;;
[0170229]183 esac
184
185 # Set the dependency for the first target.
186 if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
187
188 #--------------------------------------------------------------------#
189 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
190 #--------------------------------------------------------------------#
191 #
192 # Drop in the name of the target on a new line, and the previous target
193 # as a dependency. Also call the echo_message function.
[9272545]194
[65a2be6]195 # This is a very special script and requires manual processing
196 # NO Optimization allowed
197 if [[ ${name} = "embryo-toolchain" ]] || \
198 [[ ${name} = "cocoon-toolchain" ]]; then
199 wrt_target "$this_script" "$PREV"
200 process_toolchain "${this_script}" "${file}"
201 wrt_touch
202 PREV=$this_script
203 continue
204 fi
205 #
[0170229]206 wrt_target "$this_script" "$PREV"
207 # Find the version of the command files, if it corresponds with the building of
208 # a specific package
[3b63c8c]209 pkg_tarball=$(get_package_tarball_name $name)
210 # If $pkg_tarball isn't empty, we've got a package...
211 if [ "$pkg_tarball" != "" ] ; then
[29f9ec8]212 # Insert instructions for unpacking the package and to set the PKGDIR variable.
[9485eba]213 wrt_unpack "$pkg_tarball"
[e35e794]214 # If using optimizations, write the instructions
[c205656]215 [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[29f9ec8]216 fi
[0170229]217 # Insert date and disk usage at the top of the log file, the script run
218 # and date and disk usage again at the bottom of the log file.
[9485eba]219 wrt_RunAsUser "$this_script" "${file}"
[0170229]220
221 # Remove the build directory(ies) except if the package build fails
222 # (so we can review config.cache, config.log, etc.)
[3b63c8c]223 if [ "$pkg_tarball" != "" ] ; then
[65a2be6]224 wrt_remove_build_dirs "$name"
[0170229]225 fi
226
227 # Include a touch of the target name so make can check if it's already been made.
[9199a13]228 wrt_touch
[0170229]229 #
230 #--------------------------------------------------------------------#
231 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
232 #--------------------------------------------------------------------#
233
234 # Keep the script file name for Makefile dependencies.
235 PREV=$this_script
236 done # end for file in chapter05/*
237}
238
239
240#----------------------------#
241chapter6_Makefiles() { # sysroot or chroot build phase
242#----------------------------#
243 local file
244 local this_script
[c483858]245 # Set envars and scripts for iteration targets
246 LOGS="" # Start with an empty global LOGS envar
247 if [[ -z "$1" ]] ; then
248 local N=""
249 else
250 local N=-build_$1
251 local chapter6=""
252 mkdir chapter06$N
253 cp chapter06/* chapter06$N
254 for script in chapter06$N/* ; do
255 # Overwrite existing symlinks, files, and dirs
256 sed -e 's/ln -s /ln -sf /g' \
257 -e 's/^mv /&-f/g' -i ${script}
258 done
259 # Remove Bzip2 binaries before make install
260 sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2
261 # Fix how Module-Init-Tools do the install target
262 sed -e 's@make install@make INSTALL=install install@' -i chapter06$N/*-module-init-tools
263 # Delete *old Readline libraries just after make install
264 sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i chapter06$N/*-readline
265 # Don't readd already existing groups
266 sed -e '/groupadd/d' -i chapter06$N/*-udev
267 fi
[0170229]268
[c483858]269 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N${R_arrow}"
[0170229]270
[c483858]271 for file in chapter06$N/* ; do
[0170229]272 # Keep the script file name
273 this_script=`basename $file`
274
275 # Skip this script depending on jhalfs.conf flags set.
276 case $this_script in
277 # We'll run the chroot commands differently than the others, so skip them in the
278 # dependencies and target creation.
279 *chroot* ) continue ;;
280 # Test if the stripping phase must be skipped
281 *-stripping* ) [[ "$STRIP" = "0" ]] && continue ;;
282 esac
283
284 # Grab the name of the target
285 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
286
[3b63c8c]287 case $name in
288 uclibc) name="uClibc" ;;
289 esac
290
[c483858]291 # Find the version of the command files, if it corresponds with the building of
292 # a specific package
[3b63c8c]293 pkg_tarball=$(get_package_tarball_name $name)
[c483858]294
[3b63c8c]295 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
[c483858]296 case "${this_script}" in
297 *stripping*) ;;
298 *) continue ;;
299 esac
300 fi
301
302 # Append each name of the script files to a list (this will become
303 # the names of the targets in the Makefile
304 chapter6="$chapter6 ${this_script}${N}"
305
306 # Append each name of the script files to a list (this will become
[7635367]307 # the names of the logs to be moved for each iteration)
308 LOGS="$LOGS ${this_script}"
[c483858]309
[0170229]310
311 #--------------------------------------------------------------------#
312 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
313 #--------------------------------------------------------------------#
314 #
315 # Drop in the name of the target on a new line, and the previous target
[65a2be6]316 # as a dependency. Also call the echo_message function.
317 if [[ ${name} = "butterfly-toolchain" ]]; then
[7cd9186]318 wrt_target "${this_script}${N}" "$PREV"
[65a2be6]319 process_toolchain "${this_script}" "${file}"
320 wrt_touch
321 PREV=$this_script
322 continue
323 fi
324
[c483858]325 wrt_target "${this_script}${N}" "$PREV"
[0170229]326
[3b63c8c]327 # If $pkg_tarball isn't empty, we've got a package...
[0170229]328 # Insert instructions for unpacking the package and changing directories
[3b63c8c]329 if [ "$pkg_tarball" != "" ] ; then
330 wrt_unpack2 "$pkg_tarball"
[e35e794]331 # If the testsuites must be run, initialize the log file
[7cd9186]332 # butterfly-toolchain tests are enabled in 'process_tookchain' function
[e35e794]333 case $name in
[7cd9186]334 glibc ) [[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
[e35e794]335 ;;
[89ddac0]336 * ) [[ "$TEST" > "1" ]] && wrt_test_log2 "${this_script}"
[e35e794]337 ;;
338 esac
339 # If using optimizations, write the instructions
[c205656]340 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[0170229]341 fi
342
[9272545]343 # In the mount of kernel filesystems we need to set HLFS and not to use chroot.
[5f4d08f]344 case "${this_script}" in
345 *kernfs*)
[9485eba]346 wrt_RunAsRoot "${this_script}" "${file}"
[5f4d08f]347 ;;
348 *) # The rest of Chapter06
349 wrt_run_as_chroot1 "${this_script}" "${file}"
350 ;;
351 esac
[0170229]352 #
353 # Remove the build directory(ies) except if the package build fails.
[3b63c8c]354 if [ "$pkg_tarball" != "" ] ; then
[0170229]355 wrt_remove_build_dirs "$name"
356 fi
357 #
358 # Include a touch of the target name so make can check if it's already been made.
[9199a13]359 wrt_touch
[0170229]360 #
361 #--------------------------------------------------------------------#
362 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
363 #--------------------------------------------------------------------#
364
365 # Keep the script file name for Makefile dependencies.
[c483858]366 PREV=${this_script}${N}
367 # Set system_build envar for iteration targets
368 system_build=$chapter6
[0170229]369 done # end for file in chapter06/*
370
371}
372
373#----------------------------#
374chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..etc
375#----------------------------#
376 local file
377 local this_script
[57ca090]378
[e10232b]379 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7${R_arrow}"
[0170229]380 for file in chapter07/*; do
381 # Keep the script file name
382 this_script=`basename $file`
383
384 # Grub must be configured manually.
385 # The filesystems can't be unmounted via Makefile and the user
386 # should enter the chroot environment to create the root
387 # password, edit several files and setup Grub.
388 case $this_script in
[0ac273e]389 *usage) continue ;; # Contains example commands
[0170229]390 *grub) continue ;;
391 *console) continue ;; # Use the file generated by lfs-bootscripts
392
[57ca090]393 *kernel)
[821a2c6]394 # If no .config file is supplied, the kernel build is skipped
395 [[ -z $CONFIG ]] && continue
[1d756b0]396 cp $CONFIG $BUILDDIR/sources/kernel-config
[0170229]397 ;;
398 esac
399
400 # First append then name of the script file to a list (this will become
401 # the names of the targets in the Makefile
402 chapter7="$chapter7 $this_script"
403
404 #--------------------------------------------------------------------#
405 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
406 #--------------------------------------------------------------------#
407 #
408 # Drop in the name of the target on a new line, and the previous target
409 # as a dependency. Also call the echo_message function.
410 wrt_target "$this_script" "$PREV"
411
[5f4d08f]412 case "${this_script}" in
[db187c74]413 *bootscripts*)
[3b63c8c]414 wrt_unpack2 $(get_package_tarball_name "lfs-bootscripts")
415 blfs_bootscripts=$(get_package_tarball_name "blfs-bootscripts" | sed -e 's/.tar.*//' )
416 echo -e "\t@echo \"\$(MOUNT_PT)\$(SRC)/$blfs_bootscripts\" >> sources-dir" >> $MKFILE.tmp
[5f4d08f]417 ;;
418 esac
[0170229]419
[db187c74]420 case "${this_script}" in
[5f4d08f]421 *fstab*) # Check if we have a real /etc/fstab file
422 if [[ -n "$FSTAB" ]] ; then
423 wrt_copy_fstab "$this_script"
424 else # Initialize the log and run the script
425 wrt_run_as_chroot2 "${this_script}" "${file}"
426 fi
427 ;;
428 *) # All other scripts
429 wrt_run_as_chroot2 "${this_script}" "${file}"
430 ;;
431 esac
[0170229]432
433 # Remove the build directory except if the package build fails.
[5f4d08f]434 case "${this_script}" in
435 *bootscripts*)
[0170229]436(
437cat << EOF
[460ea63]438 @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
[0170229]439 rm -r \$(MOUNT_PT)\$(SRC)/\$\$ROOT
440 @rm -r \`cat sources-dir\` && \\
441 rm sources-dir
442EOF
443) >> $MKFILE.tmp
[5f4d08f]444 ;;
445 esac
[0170229]446
447 # Include a touch of the target name so make can check if it's already been made.
[9199a13]448 wrt_touch
[0170229]449 #
450 #--------------------------------------------------------------------#
451 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
452 #--------------------------------------------------------------------#
453
454 # Keep the script file name for Makefile dependencies.
455 PREV=$this_script
456 done # for file in chapter07/*
[9e4b9a1]457
458 # Add SBU-disk_usage report target if required
459 if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi
[0170229]460}
461
462
463#----------------------------#
464build_Makefile() { # Construct a Makefile from the book scripts
465#----------------------------#
[a702b4d]466 echo "Creating Makefile... ${BOLD}START${OFF}"
[0170229]467
468 cd $JHALFSDIR/${PROGNAME}-commands
469 # Start with a clean Makefile.tmp file
470 >$MKFILE.tmp
471
[389fe2a]472 chapter3_Makefiles
[0170229]473 chapter5_Makefiles
474 chapter6_Makefiles
[c483858]475 # Add the iterations targets, if needed
476 [[ "$COMPARE" != "0" ]] && wrt_compare_targets
[0170229]477 chapter7_Makefiles
478
479 # Add a header, some variables and include the function file
480 # to the top of the real Makefile.
481(
482 cat << EOF
483$HEADER
484
485SRC= /sources
486MOUNT_PT= $BUILDDIR
[460ea63]487PKG_LST= $PKG_LST
[9485eba]488LUSER= $LUSER
489LGROUP= $LGROUP
[0170229]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
[3a27393]517all: chapter3 chapter5 chapter6 chapter7 do-housekeeping
[0170229]518 @\$(call echo_finished,$VERSION)
519
[0ac273e]520chapter3: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
[0170229]521
[65a2be6]522chapter5: chapter3 $chapter5 restore-hlfs-env
[0170229]523
524chapter6: chapter5 $chapter6
525
526chapter7: chapter6 $chapter7
527
528clean-all: clean
[bc097cd]529 rm -rf ./{hlfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
[0170229]530
[0ac273e]531clean: clean-chapter7 clean-chapter6 clean-chapter5 clean-chapter3
[0170229]532
[3b63c8c]533restart: restart_code all
534
[0ac273e]535clean-chapter3:
[65a2be6]536 -if [ ! -f user-hlfs-exist ]; then \\
[9485eba]537 userdel \$(LUSER); \\
538 rm -rf /home/\$(LUSER); \\
[0170229]539 fi;
540 rm -rf \$(MOUNT_PT)/tools
541 rm -f /tools
[65a2be6]542 rm -f envars user-hlfs-exist
[0170229]543 rm -f 02* logs/02*.log
544
545clean-chapter5:
546 rm -rf \$(MOUNT_PT)/tools/*
[65a2be6]547 rm -f $chapter5 restore-hlfs-env sources-dir
[0170229]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
[65a2be6]564restore-hlfs-env:
[0170229]565 @\$(call echo_message, Building)
[9485eba]566 @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
567 mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
[0170229]568 fi;
[9485eba]569 @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
570 mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
[0170229]571 fi;
[9485eba]572 @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
[9199a13]573 touch \$@ && \\
574 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
575 echo --------------------------------------------------------------------------------\$(WHITE)
[0170229]576
[3a27393]577do-housekeeping:
[9199a13]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
[65a2be6]583 @-if [ ! -f user-hlfs-exist ]; then \\
[9485eba]584 userdel \$(LUSER); \\
585 rm -rf /home/\$(LUSER); \\
[3a27393]586 fi;
[460ea63]587
[3b63c8c]588restart_code:
[9272545]589 @echo ">>> This feature is experimental, BUGS may exist"
590
[3b63c8c]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;
[9272545]594
[3b63c8c]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;
[9272545]598
[3b63c8c]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;\\
[9272545]601 fi;
[3b63c8c]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
[0170229]629EOF
630) >> $MKFILE
631
632 # Bring over the items from the Makefile.tmp
633 cat $MKFILE.tmp >> $MKFILE
634 rm $MKFILE.tmp
[a702b4d]635 echo "Creating Makefile... ${BOLD}DONE${OFF}"
636
[0170229]637}
Note: See TracBrowser for help on using the repository browser.