source: HLFS/master.sh@ 1ba5024

experimental
Last change on this file since 1ba5024 was b179a81, checked in by George Boudreau <georgeb@…>, 18 years ago

Last corrections to HLFS makefile generation

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