source: HLFS/master.sh@ cb18ec7

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

Ported LUSER code and last CLFS2 fix from experimental.

  • Property mode set to 100755
File size: 20.6 KB
RevLine 
[877cc6a]1#!/bin/sh
2set -e # Enable error trapping
3
4# $Id$
5
6###################################
7### FUNCTIONS ###
8###################################
9
[d81c640]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
[1e69324]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
[d81c640]35 case ${toolchain} in
36 *butterfly*)
37(
38cat << EOF
39 @echo "export PKGDIR=\$(SRC)" > envars
40EOF
41) >> $MKFILE.tmp
[1e69324]42 [[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
[d81c640]43 wrt_run_as_chroot1 "$toolchain" "$this_script"
44 ;;
45
46 *)
47(
48cat << EOF
49 @echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)" > envars
50EOF
51) >> $MKFILE.tmp
[6ad5a2f]52 wrt_RunAsUser "$toolchain" "$this_script"
[d81c640]53 ;;
54 esac
55 #
[6ad5a2f]56 # Safe method to remove packages unpacked while inside the toolchain script
[d81c640]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"
61 #
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
[877cc6a]73
74#----------------------------#
75chapter3_Makefiles() { # Initialization of the system
76#----------------------------#
77
78 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter3${R_arrow}"
79
80 # Define a few model dependant variables
81 if [[ ${MODEL} = "uclibc" ]]; then
[d81c640]82 TARGET="pc-linux-gnu"; LOADER="ld-uClibc.so.0"
[877cc6a]83 else
[d81c640]84 TARGET="pc-linux-gnu"; LOADER="ld-linux.so.2"
[877cc6a]85 fi
86
[6ad5a2f]87 # If /home/$LUSER is already present in the host, we asume that the
[d81c640]88 # hlfs user and group are also presents in the host, and a backup
[877cc6a]89 # of their bash init files is made.
90(
91cat << EOF
92020-creatingtoolsdir:
93 @\$(call echo_message, Building)
[e314f7e]94 @mkdir \$(MOUNT_PT)/tools && \\
95 rm -f /tools && \\
96 ln -s \$(MOUNT_PT)/tools /
[877cc6a]97 @if [ ! -d \$(MOUNT_PT)/sources ]; then \\
98 mkdir \$(MOUNT_PT)/sources; \\
99 fi;
100 @chmod a+wt \$(MOUNT_PT)/sources && \\
[93f38e7]101 touch \$@ && \\
102 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
103 echo --------------------------------------------------------------------------------\$(WHITE)
[877cc6a]104
105021-addinguser: 020-creatingtoolsdir
106 @\$(call echo_message, Building)
[6ad5a2f]107 @if [ ! -d /home/\$(LUSER) ]; then \\
108 groupadd \$(LGROUP); \\
109 useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
[877cc6a]110 else \\
[6ad5a2f]111 touch luser-exist; \\
[877cc6a]112 fi;
[6ad5a2f]113 @chown \$(LUSER) \$(MOUNT_PT)/tools && \\
114 chown \$(LUSER) \$(MOUNT_PT)/sources && \\
[93f38e7]115 touch \$@ && \\
116 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
117 echo --------------------------------------------------------------------------------\$(WHITE)
[877cc6a]118
119022-settingenvironment: 021-addinguser
120 @\$(call echo_message, Building)
[6ad5a2f]121 @if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
122 mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
[877cc6a]123 fi;
[6ad5a2f]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; \\
[877cc6a]126 fi;
[6ad5a2f]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 && \\
[877cc6a]139 touch envars && \\
[93f38e7]140 touch \$@ && \\
141 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
142 echo --------------------------------------------------------------------------------\$(WHITE)
[877cc6a]143EOF
144) >> $MKFILE.tmp
145
146}
147
148#----------------------------#
149chapter5_Makefiles() { # Bootstrap or temptools phase
150#----------------------------#
151 local file
152 local this_script
153
154 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5${R_arrow}"
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
163 *tcl* ) [[ "$TEST" = "0" ]] && continue; ;;
164 *expect* ) [[ "$TEST" = "0" ]] && continue; ;;
165 *dejagnu* ) [[ "$TEST" = "0" ]] && continue; ;;
166 # Nothing interestin in this script
167 *introduction* ) continue ;;
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
[d81c640]177 # Grab the name of the target
178 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
[877cc6a]179
180 # Adjust 'name'
181 case $name in
[a160d86]182 uclibc) name="uClibc" ;;
[877cc6a]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.
194
[d81c640]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 #
206 wrt_target "$this_script" "$PREV"
[877cc6a]207 # Find the version of the command files, if it corresponds with the building of
208 # a specific package
[a160d86]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
[1b65a84]212 # Insert instructions for unpacking the package and to set the PKGDIR variable.
[6ad5a2f]213 wrt_unpack "$pkg_tarball"
[a229600]214 # If using optimizations, write the instructions
[1b65a84]215 [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
216 fi
[877cc6a]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.
[6ad5a2f]219 wrt_RunAsUser "$this_script" "${file}"
[877cc6a]220
221 # Remove the build directory(ies) except if the package build fails
222 # (so we can review config.cache, config.log, etc.)
[a160d86]223 if [ "$pkg_tarball" != "" ] ; then
[d81c640]224 wrt_remove_build_dirs "$name"
[877cc6a]225 fi
226
227 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]228 wrt_touch
[877cc6a]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
[45f82718]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
[877cc6a]268
[45f82718]269 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N${R_arrow}"
[877cc6a]270
[45f82718]271 for file in chapter06$N/* ; do
[877cc6a]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
[a160d86]287 case $name in
288 uclibc) name="uClibc" ;;
289 esac
290
[45f82718]291 # Find the version of the command files, if it corresponds with the building of
292 # a specific package
[a160d86]293 pkg_tarball=$(get_package_tarball_name $name)
[45f82718]294
[a160d86]295 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
[45f82718]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
307 # the names of the logs to be moved for each iteration)
308 LOGS="$LOGS ${this_script}"
309
[877cc6a]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
[d81c640]316 # as a dependency. Also call the echo_message function.
317 if [[ ${name} = "butterfly-toolchain" ]]; then
[7613d3c]318 wrt_target "${this_script}${N}" "$PREV"
[d81c640]319 process_toolchain "${this_script}" "${file}"
320 wrt_touch
321 PREV=$this_script
322 continue
323 fi
324
[45f82718]325 wrt_target "${this_script}${N}" "$PREV"
[877cc6a]326
[a160d86]327 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]328 # Insert instructions for unpacking the package and changing directories
[a160d86]329 if [ "$pkg_tarball" != "" ] ; then
330 wrt_unpack2 "$pkg_tarball"
[a229600]331 # If the testsuites must be run, initialize the log file
[7613d3c]332 # butterfly-toolchain tests are enabled in 'process_tookchain' function
[a229600]333 case $name in
[7613d3c]334 glibc ) [[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
[a229600]335 ;;
[1e69324]336 * ) [[ "$TEST" > "1" ]] && wrt_test_log2 "${this_script}"
[a229600]337 ;;
338 esac
339 # If using optimizations, write the instructions
[1b65a84]340 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[877cc6a]341 fi
342
[d81c640]343 # In the mount of kernel filesystems we need to set HLFS and not to use chroot.
[877cc6a]344 case "${this_script}" in
345 *kernfs*)
[6ad5a2f]346 wrt_RunAsRoot "${this_script}" "${file}"
[877cc6a]347 ;;
348 *) # The rest of Chapter06
349 wrt_run_as_chroot1 "${this_script}" "${file}"
350 ;;
351 esac
352 #
353 # Remove the build directory(ies) except if the package build fails.
[a160d86]354 if [ "$pkg_tarball" != "" ] ; then
[877cc6a]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.
[93f38e7]359 wrt_touch
[877cc6a]360 #
361 #--------------------------------------------------------------------#
362 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
363 #--------------------------------------------------------------------#
364
365 # Keep the script file name for Makefile dependencies.
[45f82718]366 PREV=${this_script}${N}
367 # Set system_build envar for iteration targets
368 system_build=$chapter6
[877cc6a]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
378
379 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7${R_arrow}"
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
389 *usage) continue ;; # Contains example commands
390 *grub) continue ;;
391 *console) continue ;; # Use the file generated by lfs-bootscripts
392
393 *kernel)
394 # If no .config file is supplied, the kernel build is skipped
395 [[ -z $CONFIG ]] && continue
396 cp $CONFIG $BUILDDIR/sources/kernel-config
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
412 case "${this_script}" in
413 *bootscripts*)
[a160d86]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
[877cc6a]417 ;;
418 esac
419
420 case "${this_script}" in
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
432
433 # Remove the build directory except if the package build fails.
434 case "${this_script}" in
435 *bootscripts*)
436(
437cat << EOF
[82eb8c1]438 @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
[877cc6a]439 rm -r \$(MOUNT_PT)\$(SRC)/\$\$ROOT
440 @rm -r \`cat sources-dir\` && \\
441 rm sources-dir
442EOF
443) >> $MKFILE.tmp
444 ;;
445 esac
446
447 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]448 wrt_touch
[877cc6a]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/*
[453bef0]457
458 # Add SBU-disk_usage report target if required
459 if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi
[877cc6a]460}
461
462
463#----------------------------#
464build_Makefile() { # Construct a Makefile from the book scripts
465#----------------------------#
[c7c5a53]466 echo "Creating Makefile... ${BOLD}START${OFF}"
[877cc6a]467
468 cd $JHALFSDIR/${PROGNAME}-commands
469 # Start with a clean Makefile.tmp file
470 >$MKFILE.tmp
471
472 chapter3_Makefiles
473 chapter5_Makefiles
474 chapter6_Makefiles
[45f82718]475 # Add the iterations targets, if needed
476 [[ "$COMPARE" != "0" ]] && wrt_compare_targets
[877cc6a]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
[82eb8c1]487PKG_LST= $PKG_LST
[6ad5a2f]488LUSER= $LUSER
489LGROUP= $LGROUP
[877cc6a]490
491include makefile-functions
492
493EOF
494) > $MKFILE
495
496
497 # Add chroot commands
[6ad5a2f]498 CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
[877cc6a]499 i=1
500 for file in chapter06/*chroot* ; do
[6ad5a2f]501 chroot=`cat $file | \
502 sed -e "s@chroot@$CHROOT_LOC@" \
503 -e '/#!\/bin\/sh/d' \
504 -e '/^export/d' \
505 -e '/^logout/d' \
506 -e 's@ \\\@ @g' | \
507 tr -d '\n' | \
508 sed -e 's/ */ /g' \
509 -e 's|\\$|&&|g' \
510 -e 's|exit||g' \
511 -e 's|$| -c|' \
512 -e 's|"$$HLFS"|$(MOUNT_PT)|'\
513 -e 's|set -e||'`
[877cc6a]514 echo -e "CHROOT$i= $chroot\n" >> $MKFILE
515 i=`expr $i + 1`
516 done
517
518 # Drop in the main target 'all:' and the chapter targets with each sub-target
519 # as a dependency.
520(
521 cat << EOF
[c8f9cd8]522all: chapter3 chapter5 chapter6 chapter7 do-housekeeping
[877cc6a]523 @\$(call echo_finished,$VERSION)
524
525chapter3: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
526
[6ad5a2f]527chapter5: chapter3 $chapter5 restore-luser-env
[877cc6a]528
529chapter6: chapter5 $chapter6
530
531chapter7: chapter6 $chapter7
532
533clean-all: clean
534 rm -rf ./{hlfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
535
536clean: clean-chapter7 clean-chapter6 clean-chapter5 clean-chapter3
537
[a160d86]538restart: restart_code all
539
[877cc6a]540clean-chapter3:
[6ad5a2f]541 -if [ ! -f luser-exist ]; then \\
542 userdel \$(LUSER); \\
543 rm -rf /home/\$(LUSER); \\
[877cc6a]544 fi;
545 rm -rf \$(MOUNT_PT)/tools
546 rm -f /tools
[6ad5a2f]547 rm -f envars luser-exist
[877cc6a]548 rm -f 02* logs/02*.log
549
550clean-chapter5:
551 rm -rf \$(MOUNT_PT)/tools/*
[6ad5a2f]552 rm -f $chapter5 restore-luser-env sources-dir
[877cc6a]553 cd logs && rm -f $chapter5 && cd ..
554
555clean-chapter6:
556 -umount \$(MOUNT_PT)/sys
557 -umount \$(MOUNT_PT)/proc
558 -umount \$(MOUNT_PT)/dev/shm
559 -umount \$(MOUNT_PT)/dev/pts
560 -umount \$(MOUNT_PT)/dev
561 rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
562 rm -f $chapter6
563 cd logs && rm -f $chapter6 && cd ..
564
565clean-chapter7:
566 rm -f $chapter7
567 cd logs && rm -f $chapter7 && cd ..
568
[6ad5a2f]569restore-luser-env:
[877cc6a]570 @\$(call echo_message, Building)
[6ad5a2f]571 @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
572 mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
[877cc6a]573 fi;
[6ad5a2f]574 @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
575 mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
[877cc6a]576 fi;
[6ad5a2f]577 @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
[93f38e7]578 touch \$@ && \\
579 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
580 echo --------------------------------------------------------------------------------\$(WHITE)
[877cc6a]581
[7d9a82d]582do-housekeeping:
[4524fb2]583 @-umount \$(MOUNT_PT)/dev/pts
584 @-umount \$(MOUNT_PT)/dev/shm
585 @-umount \$(MOUNT_PT)/dev
586 @-umount \$(MOUNT_PT)/sys
587 @-umount \$(MOUNT_PT)/proc
[6ad5a2f]588 @-if [ ! -f luser-exist ]; then \\
589 userdel \$(LUSER); \\
590 rm -rf /home/\$(LUSER); \\
[7d9a82d]591 fi;
[a858a78]592
[a160d86]593restart_code:
[d81c640]594 @echo ">>> This feature is experimental, BUGS may exist"
595
[a160d86]596 @if [ ! -L /tools ]; then \\
597 echo -e "\\nERROR::\\n /tools is NOT a symlink.. /tools must point to \$(MOUNT_PT)/tools\\n" && false;\\
598 fi;
[d81c640]599
[a160d86]600 @if [ ! -e /tools ]; then \\
601 echo -e "\\nERROR::\\nThe target /tools points to does not exist.\\nVerify the target.. \$(MOUNT_PT)/tools\\n" && false;\\
602 fi;
[d81c640]603
[a160d86]604 @if ! stat -c %N /tools | grep "\$(MOUNT_PT)/tools" >/dev/null ; then \\
605 echo -e "\\nERROR::\\nThe symlink \\"/tools\\" does not point to \\"\$(MOUNT_PT)/tools\\".\\nCorrect the problem and rerun\\n" && false;\\
[d81c640]606 fi;
[a160d86]607
608 @if [ -f ???-kernfs ]; then \\
609 mkdir -pv \$(MOUNT_PT)/{proc,sys};\\
610 if ! mount -l | "\$(MOUNT_PT)/dev" >/dev/null ; then \\
611 mount -vt ramfs ramfs \$(MOUNT_PT)/dev;\\
612 fi;\\
613 if [ ! -e \$(MOUNT_PT)/dev/console ]; then \\
614 mknod -m 600 \$(MOUNT_PT)/dev/console c 5 1;\\
615 fi;\\
616 if [ ! -e \$(MOUNT_PT)/dev/null ]; then \\
617 mknod -m 666 \$(MOUNT_PT)/dev/null c 1 3;\\
618 fi;\\
619 if ! mount -l | grep "\$(MOUNT_PT)/dev/pts" >/dev/null ; then \\
620 mount -vt devpts -o gid=4,mode=620 devpts \$(MOUNT_PT)/dev/pts;\\
621 fi;\\
622 if ! mount -l | grep "\$(MOUNT_PT)/dev/shm" >/dev/null ; then \\
623 mount -vt tmpfs shm \$(MOUNT_PT)/dev/shm;\\
624 fi;\\
625 if ! mount -l | grep "\$(MOUNT_PT)/proc" >/dev/null ; then \\
626 mount -vt proc proc \$(MOUNT_PT)/proc;\\
627 fi;\\
628 if ! mount -l | grep "\$(MOUNT_PT)/sys" >/dev/null ; then \\
629 mount -vt sysfs sysfs \$(MOUNT_PT)/sys;\\
630 fi;\\
631 fi;
632
633
[877cc6a]634EOF
635) >> $MKFILE
636
637 # Bring over the items from the Makefile.tmp
638 cat $MKFILE.tmp >> $MKFILE
639 rm $MKFILE.tmp
[c7c5a53]640 echo "Creating Makefile... ${BOLD}DONE${OFF}"
641
[877cc6a]642}
Note: See TracBrowser for help on using the repository browser.