source: HLFS/master.sh@ 9485eba

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

Implement suggestion made byDan Nicholson for configurable user/group. Required many changes and allowed for the removal of user specific function calls. Tnx Dan

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