source: HLFS/master.sh@ f98695c

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

Ported Makefile clean-up and 0/1 to n/y migration code from experimental.
There is no obvious bugs, let users to find hidden bugs.

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