source: LFS/master.sh@ 9d55d85

2.3 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 9d55d85 was 0850553, checked in by George Boudreau <georgeb@…>, 16 years ago

LFS has new build method. Added new vars to LFS/master.sh (JHuntwork)

  • Property mode set to 100644
File size: 18.5 KB
RevLine 
[91ff6a9]1#!/bin/bash
[877cc6a]2
3# $Id$
4
5###################################
6### FUNCTIONS ###
7###################################
8
9
[045b2dc]10#############################################################
11
12
[877cc6a]13#----------------------------#
[045b2dc]14chapter4_Makefiles() { #
[877cc6a]15#----------------------------#
[045b2dc]16 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4 ( SETUP ) ${R_arrow}"
[877cc6a]17
[962793a]18# If $LUSER_HOME is already present in the host, we asume that the
[877cc6a]19# lfs user and group are also presents in the host, and a backup
20# of their bash init files is made.
21(
22 cat << EOF
23020-creatingtoolsdir:
24 @\$(call echo_message, Building)
[cee9568]25 @mkdir \$(MOUNT_PT)/tools && \\
26 rm -f /tools && \\
[dbcdfd7]27 ln -s \$(MOUNT_PT)/tools /
28 @\$(call housekeeping)
[877cc6a]29
30021-addinguser: 020-creatingtoolsdir
31 @\$(call echo_message, Building)
[962793a]32 @if [ ! -d \$(LUSER_HOME) ]; then \\
[6ad5a2f]33 groupadd \$(LGROUP); \\
34 useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
[877cc6a]35 else \\
[6ad5a2f]36 touch luser-exist; \\
[877cc6a]37 fi;
[6ad5a2f]38 @chown \$(LUSER) \$(MOUNT_PT)/tools && \\
[ac35c8e]39 chmod -R a+wt \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
[dbcdfd7]40 chmod a+wt \$(SRCSDIR)
41 @\$(call housekeeping)
[877cc6a]42
43022-settingenvironment: 021-addinguser
44 @\$(call echo_message, Building)
[962793a]45 @if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
46 mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
[877cc6a]47 fi;
[962793a]48 @if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
49 mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
[877cc6a]50 fi;
[962793a]51 @echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
52 echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
53 echo "LFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
54 echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
[0850553]55 echo "LFS_TGT=`uname -m`-lfs-linux-gnu" >> \$(LUSER_HOME)/.bashrc && \\
[962793a]56 echo "PATH=/tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
[0850553]57 echo "export LFS LC_ALL LFS_TGT PATH" >> \$(LUSER_HOME)/.bashrc && \\
[962793a]58 echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc && \\
59 chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
[877cc6a]60 touch envars && \\
[dbcdfd7]61 chown \$(LUSER) envars
62 @\$(call housekeeping)
[877cc6a]63EOF
[045b2dc]64) > $MKFILE.tmp
65
66 chapter4=" 020-creatingtoolsdir 021-addinguser 022-settingenvironment"
[877cc6a]67}
68
[045b2dc]69
70
[877cc6a]71#----------------------------#
72chapter5_Makefiles() {
73#----------------------------#
[045b2dc]74 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5 ( LUSER ) ${R_arrow}"
[877cc6a]75
76 for file in chapter05/* ; do
77 # Keep the script file name
78 this_script=`basename $file`
79
80 # If no testsuites will be run, then TCL, Expect and DejaGNU aren't needed
[a241c33]81 # Fix also locales creation when running chapter05 testsuites (ugly)
[877cc6a]82 case "${this_script}" in
83 *tcl) [[ "${TEST}" = "0" ]] && continue ;;
84 *expect) [[ "${TEST}" = "0" ]] && continue ;;
85 *dejagnu) [[ "${TEST}" = "0" ]] && continue ;;
[401f81e]86 *stripping) [[ "${STRIP}" = "n" ]] && continue ;;
[a241c33]87 *glibc) [[ "${TEST}" = "3" ]] && \
[d46a46e]88 sed -i 's@/usr/lib/locale@/tools/lib/locale@' $file ;;
[877cc6a]89 esac
90
91 # First append each name of the script files to a list (this will become
92 # the names of the targets in the Makefile
[4eba1ea]93 # DO NOT append the changingowner script, it need be run as root.
[045b2dc]94 # A hack is necessary: create script in chap5 BUT run as a dependency for
[4eba1ea]95 # SUDO target
[045b2dc]96 case "${this_script}" in
[4eba1ea]97 *changingowner) runasroot="$runasroot ${this_script}" ;;
[045b2dc]98 *) chapter5="$chapter5 ${this_script}" ;;
99 esac
[877cc6a]100
101 # Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
102 # and binutils in chapter 5)
103 name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'`
104
105 # Set the dependency for the first target.
106 if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
107
108 #--------------------------------------------------------------------#
109 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
110 #--------------------------------------------------------------------#
111 #
112 # Drop in the name of the target on a new line, and the previous target
113 # as a dependency. Also call the echo_message function.
[045b2dc]114 LUSER_wrt_target "${this_script}" "$PREV"
[877cc6a]115
116 # Find the version of the command files, if it corresponds with the building of
117 # a specific package
[a160d86]118 pkg_tarball=$(get_package_tarball_name $name)
[b7faa5a]119
[a160d86]120 # If $pkg_tarball isn't empty, we've got a package...
121 if [ "$pkg_tarball" != "" ] ; then
[877cc6a]122 # Insert instructions for unpacking the package and to set the PKGDIR variable.
[045b2dc]123 LUSER_wrt_unpack "$pkg_tarball"
[a229600]124 # If the testsuites must be run, initialize the log file
[045b2dc]125 [[ "$TEST" = "3" ]] && LUSER_wrt_test_log "${this_script}"
[a229600]126 # If using optimizations, write the instructions
[1b65a84]127 [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[877cc6a]128 fi
129
130 # Insert date and disk usage at the top of the log file, the script run
131 # and date and disk usage again at the bottom of the log file.
[a241c33]132 # The changingowner script must be run as root.
133 case "${this_script}" in
[8f2c086]134 *changingowner) wrt_RunAsRoot "$file" ;;
[045b2dc]135 *) LUSER_wrt_RunAsUser "$file" ;;
[a241c33]136 esac
[877cc6a]137
138 # Remove the build directory(ies) except if the package build fails
139 # (so we can review config.cache, config.log, etc.)
[a160d86]140 if [ "$pkg_tarball" != "" ] ; then
[045b2dc]141 LUSER_RemoveBuildDirs "$name"
[877cc6a]142 fi
143
144 # Include a touch of the target name so make can check
145 # if it's already been made.
[e2ef100]146 wrt_touch
[877cc6a]147 #
148 #--------------------------------------------------------------------#
149 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
150 #--------------------------------------------------------------------#
151
152 # Keep the script file name for Makefile dependencies.
153 PREV=${this_script}
154 done # end for file in chapter05/*
155}
156
[045b2dc]157
[877cc6a]158#----------------------------#
159chapter6_Makefiles() {
160#----------------------------#
[045b2dc]161
[45f82718]162 # Set envars and scripts for iteration targets
163 if [[ -z "$1" ]] ; then
164 local N=""
165 else
166 local N=-build_$1
167 local chapter6=""
168 mkdir chapter06$N
169 cp chapter06/* chapter06$N
170 for script in chapter06$N/* ; do
171 # Overwrite existing symlinks, files, and dirs
172 sed -e 's/ln -sv/&f/g' \
173 -e 's/mv -v/&f/g' \
174 -e 's/mkdir -v/&p/g' -i ${script}
[10c8b78]175 # Rename the scripts
176 mv ${script} ${script}$N
[45f82718]177 done
[a5f52ba]178 # Remove Bzip2 binaries before make install (LFS-6.2 compatibility)
179 sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2$N
[45f82718]180 fi
181
[045b2dc]182 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}"
[45f82718]183
184 for file in chapter06$N/* ; do
[877cc6a]185 # Keep the script file name
186 this_script=`basename $file`
187
188 # We'll run the chroot commands differently than the others, so skip them in the
189 # dependencies and target creation.
[8426d1f]190 # Skip also linux-headers in iterative builds.
[877cc6a]191 case "${this_script}" in
192 *chroot) continue ;;
[401f81e]193 *stripping*) [[ "${STRIP}" = "n" ]] && continue ;;
[8426d1f]194 *linux-headers*) [[ -n "$N" ]] && continue ;;
[877cc6a]195 esac
196
[4eba1ea]197 # Grab the name of the target.
[10c8b78]198 name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' -e 's,'$N',,'`
[877cc6a]199
[45f82718]200 # Find the version of the command files, if it corresponds with the building of
201 # a specific package. We need this here to can skip scripts not needed for
202 # iterations rebuilds
[a160d86]203 pkg_tarball=$(get_package_tarball_name $name)
[45f82718]204
[a160d86]205 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
[45f82718]206 case "${this_script}" in
207 *stripping*) ;;
208 *) continue ;;
209 esac
210 fi
211
212 # Append each name of the script files to a list (this will become
213 # the names of the targets in the Makefile)
[4eba1ea]214 # The kernfs script must be run as part of SUDO target.
215 case "${this_script}" in
216 *kernfs) runasroot="$runasroot ${this_script}" ;;
[10c8b78]217 *) chapter6="$chapter6 ${this_script}" ;;
[4eba1ea]218 esac
[45f82718]219
[877cc6a]220 #--------------------------------------------------------------------#
221 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
222 #--------------------------------------------------------------------#
223 #
224 # Drop in the name of the target on a new line, and the previous target
225 # as a dependency. Also call the echo_message function.
[8bea2c8]226 # In the mount of kernel filesystems we need to set LFS
227 # and not to use chroot.
228 case "${this_script}" in
229 *kernfs) LUSER_wrt_target "${this_script}" "$PREV" ;;
[10c8b78]230 *) CHROOT_wrt_target "${this_script}" "$PREV" ;;
[8bea2c8]231 esac
[877cc6a]232
[a160d86]233 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]234 # Insert instructions for unpacking the package and changing directories
[a160d86]235 if [ "$pkg_tarball" != "" ] ; then
[38d2de6]236 # Touch timestamp file if installed files logs will be created.
[81fca31]237 # But only for the firt build when running iterative builds.
238 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
[93346ee]239 CHROOT_wrt_TouchTimestamp
240 fi
[045b2dc]241 CHROOT_Unpack "$pkg_tarball"
[a229600]242 # If the testsuites must be run, initialize the log file
243 case $name in
244 binutils | gcc | glibc )
[10c8b78]245 [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}"
[a229600]246 ;;
247 * )
[10c8b78]248 [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && CHROOT_wrt_test_log "${this_script}"
[a229600]249 ;;
250 esac
251 # If using optimizations, write the instructions
[1b65a84]252 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[877cc6a]253 fi
254
255 # In the mount of kernel filesystems we need to set LFS
256 # and not to use chroot.
257 case "${this_script}" in
[8f2c086]258 *kernfs) wrt_RunAsRoot "$file" ;;
[045b2dc]259 *) CHROOT_wrt_RunAsRoot "$file" ;;
[877cc6a]260 esac
261
[93346ee]262 # Write installed files log and remove the build directory(ies)
263 # except if the package build fails.
[a160d86]264 if [ "$pkg_tarball" != "" ] ; then
[045b2dc]265 CHROOT_wrt_RemoveBuildDirs "$name"
[81fca31]266 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
[93346ee]267 CHROOT_wrt_LogNewFiles "$name"
268 fi
[877cc6a]269 fi
270
271 # Include a touch of the target name so make can check
272 # if it's already been made.
[e2ef100]273 wrt_touch
[877cc6a]274 #
275 #--------------------------------------------------------------------#
276 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
277 #--------------------------------------------------------------------#
278
279 # Keep the script file name for Makefile dependencies.
[10c8b78]280 PREV=${this_script}
[45f82718]281 # Set system_build envar for iteration targets
282 system_build=$chapter6
[877cc6a]283 done # end for file in chapter06/*
284}
285
286#----------------------------#
[14eaa9f]287chapter78_Makefiles() {
[877cc6a]288#----------------------------#
[b11c10b]289 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8 ( BOOT ) ${R_arrow}"
[877cc6a]290
[14eaa9f]291 for file in chapter0{7,8}/* ; do
[877cc6a]292 # Keep the script file name
293 this_script=`basename $file`
294
295 # Grub must be configured manually.
[14eaa9f]296 # Handle fstab creation.
[877cc6a]297 # If no .config file is supplied, the kernel build is skipped
298 case ${this_script} in
299 *grub) continue ;;
[045b2dc]300 *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
[877cc6a]301 *kernel) [[ -z ${CONFIG} ]] && continue
302 cp ${CONFIG} $BUILDDIR/sources/kernel-config ;;
303 esac
304
305 # First append each name of the script files to a list (this will become
306 # the names of the targets in the Makefile
[14eaa9f]307 chapter78="$chapter78 ${this_script}"
[877cc6a]308
309 #--------------------------------------------------------------------#
310 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
311 #--------------------------------------------------------------------#
312 #
313 # Drop in the name of the target on a new line, and the previous target
314 # as a dependency. Also call the echo_message function.
[045b2dc]315 CHROOT_wrt_target "${this_script}" "$PREV"
[877cc6a]316
317 # Find the bootscripts and kernel package names
318 case "${this_script}" in
319 *bootscripts)
[a160d86]320 name="lfs-bootscripts"
321 pkg_tarball=$(get_package_tarball_name $name)
[93346ee]322 if [ "${INSTALL_LOG}" = "y" ] ; then
323 CHROOT_wrt_TouchTimestamp
324 fi
[81fca31]325 CHROOT_Unpack "$pkg_tarball"
[877cc6a]326 ;;
327 *kernel)
[a160d86]328 name="linux"
329 pkg_tarball=$(get_package_tarball_name $name)
[93346ee]330 if [ "${INSTALL_LOG}" = "y" ] ; then
331 CHROOT_wrt_TouchTimestamp
332 fi
[81fca31]333 CHROOT_Unpack "$pkg_tarball"
[877cc6a]334 ;;
335 esac
336
337 # Check if we have a real /etc/fstab file
338 case "${this_script}" in
339 *fstab) if [[ -n $FSTAB ]]; then
[045b2dc]340 CHROOT_wrt_CopyFstab
[877cc6a]341 else
[045b2dc]342 CHROOT_wrt_RunAsRoot "$file"
[877cc6a]343 fi
344 ;;
[045b2dc]345 *) CHROOT_wrt_RunAsRoot "$file"
[877cc6a]346 ;;
347 esac
348
349 case "${this_script}" in
[93346ee]350 *bootscripts) CHROOT_wrt_RemoveBuildDirs "dummy"
351 if [ "${INSTALL_LOG}" = "y" ] ; then
352 CHROOT_wrt_LogNewFiles "$name"
353 fi ;;
354 *kernel) CHROOT_wrt_RemoveBuildDirs "dummy"
355 if [ "${INSTALL_LOG}" = "y" ] ; then
356 CHROOT_wrt_LogNewFiles "$name"
357 fi ;;
[877cc6a]358 esac
359
360 # Include a touch of the target name so make can check
361 # if it's already been made.
[e2ef100]362 wrt_touch
[877cc6a]363 #
364 #--------------------------------------------------------------------#
365 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
366 #--------------------------------------------------------------------#
367
368 # Keep the script file name for Makefile dependencies.
369 PREV=${this_script}
[14eaa9f]370 done # for file in chapter0{7,8}/*
[453bef0]371
[877cc6a]372}
373
374
[045b2dc]375
[877cc6a]376#----------------------------#
[045b2dc]377build_Makefile() { #
[877cc6a]378#----------------------------#
[045b2dc]379
[c7c5a53]380 echo "Creating Makefile... ${BOLD}START${OFF}"
[045b2dc]381
[877cc6a]382 cd $JHALFSDIR/${PROGNAME}-commands
383
384 # Start with a clean Makefile.tmp file
[045b2dc]385 >$MKFILE
[877cc6a]386
387 chapter4_Makefiles
388 chapter5_Makefiles
389 chapter6_Makefiles
[45f82718]390 # Add the iterations targets, if needed
[401f81e]391 [[ "$COMPARE" = "y" ]] && wrt_compare_targets
[14eaa9f]392 chapter78_Makefiles
[3e7ceed]393 # Add the CUSTOM_TOOLS targets, if needed
394 [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
[045b2dc]395 # Add the BLFS_TOOL targets, if needed
396 [[ "$BLFS_TOOL" = "y" ]] && wrt_blfs_tool_targets
[877cc6a]397
398 # Add a header, some variables and include the function file
399 # to the top of the real Makefile.
[195ed9f]400 wrt_Makefile_header
[877cc6a]401
402 # Add chroot commands
[6ad5a2f]403 CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
[877cc6a]404 i=1
405 for file in chapter06/*chroot* ; do
[6ad5a2f]406 chroot=`cat $file | \
407 sed -e "s@chroot@$CHROOT_LOC@" \
[d3802b1]408 -e '/#!\/bin\/bash/d' \
[6ad5a2f]409 -e 's@ \\\@ @g' | \
410 tr -d '\n' | \
411 sed -e 's/ */ /g' \
412 -e 's|\\$|&&|g' \
413 -e 's|exit||g' \
414 -e 's|$| -c|' \
415 -e 's|"$$LFS"|$(MOUNT_PT)|' \
[f3a7f3b]416 -e 's|set -e||' \
417 -e 's|set +h||'`
[877cc6a]418 echo -e "CHROOT$i= $chroot\n" >> $MKFILE
419 i=`expr $i + 1`
420 done
421
422 # Drop in the main target 'all:' and the chapter targets with each sub-target
423 # as a dependency.
424(
425 cat << EOF
[045b2dc]426
[3e7ceed]427all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL
[045b2dc]428 @sudo make do_housekeeping
[ac35c8e]429 @echo "$VERSION - jhalfs build" > lfs-release && \\
430 sudo mv lfs-release \$(MOUNT_PT)/etc
[877cc6a]431 @\$(call echo_finished,$VERSION)
432
[045b2dc]433ck_UID:
434 @if [ \`id -u\` = "0" ]; then \\
435 echo "--------------------------------------------------"; \\
436 echo "You cannot run this makefile from the root account"; \\
437 echo "--------------------------------------------------"; \\
438 exit 1; \\
439 fi
440
[7c17066]441ck_LFS:
442 @if [ \`echo \$(LFS)\`x = "x" ]; then \\
443 echo "--------------------------------------------------"; \\
444 echo "Enviroment variable LFS must be set"; \\
445 echo "--------------------------------------------------"; \\
446 exit 1; \
447 fi
448
[045b2dc]449mk_SETUP:
450 @\$(call echo_SU_request)
[dbcdfd7]451 @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
[045b2dc]452 @touch \$@
453
454mk_LUSER: mk_SETUP
455 @\$(call echo_SULUSER_request)
[dbcdfd7]456 @( sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) LUSER" )
[045b2dc]457 @sudo make restore-luser-env
458 @touch \$@
459
460mk_SUDO: mk_LUSER
[dbcdfd7]461 @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
[1330ebc]462 @touch \$@
463
[045b2dc]464mk_CHROOT: mk_SUDO
465 @\$(call echo_CHROOT_request)
[dbcdfd7]466 @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT")
[045b2dc]467 @touch \$@
[877cc6a]468
[045b2dc]469mk_BOOT: mk_CHROOT
470 @\$(call echo_CHROOT_request)
[dbcdfd7]471 @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BOOT")
[045b2dc]472 @touch \$@
[877cc6a]473
[3e7ceed]474mk_CUSTOM_TOOLS: create-sbu_du-report
475 @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
[3bc6078]476 \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
[3e7ceed]477 sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
[dbcdfd7]478 (sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
[3e7ceed]479 fi;
480 @touch \$@
481
482mk_BLFS_TOOL: mk_CUSTOM_TOOLS
[1838bc7]483 @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
[3bc6078]484 \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
[1838bc7]485 sudo mkdir -p $BUILDDIR$TRACKING_DIR; \\
[dbcdfd7]486 (sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BLFS_TOOL"); \\
[1838bc7]487 fi;
488 @touch \$@
[877cc6a]489
[7c17066]490devices: ck_LFS ck_UID
491 sudo mount -v --bind /dev \$(LFS)/dev
492 sudo mount -vt devpts devpts \$(LFS)/dev/pts
493 sudo mount -vt tmpfs shm \$(LFS)/dev/shm
494 sudo mount -vt proc proc \$(LFS)/proc
495 sudo mount -vt sysfs sysfs \$(LFS)/sys
496
497teardown: ck_LFS
498 sudo umount -v \$(LFS)/sys
499 sudo umount -v \$(LFS)/proc
500 sudo umount -v \$(LFS)/dev/shm
501 sudo umount -v \$(LFS)/dev/pts
502 sudo umount -v \$(LFS)/dev
503
504chroot: devices
505 sudo /usr/sbin/chroot \$(LFS) /tools/bin/env -i \\
506 HOME=/root TERM=\$(TERM) PS1='\\u:\\w\\\$\$ ' \\
507 PATH=/bin:/usr/bin:/sbin:/usr/sbin \\
508 /tools/bin/bash --login
509 \$(MAKE) teardown
[877cc6a]510
[3e7ceed]511SETUP: $chapter4
512LUSER: $chapter5
513SUDO: $runasroot
[aec4483]514CHROOT: SHELL=/tools/bin/bash
[3e7ceed]515CHROOT: $chapter6
516BOOT: $chapter78
517CUSTOM_TOOLS: $custom_list
518BLFS_TOOL: $blfs_tool
[fe24ca6]519
[045b2dc]520
[1838bc7]521create-sbu_du-report: mk_BOOT
522 @\$(call echo_message, Building)
523 @if [ "\$(ADD_REPORT)" = "y" ]; then \\
524 ./create-sbu_du-report.sh logs $VERSION; \\
525 \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
526 fi;
527 @touch \$@
[045b2dc]528
[6ad5a2f]529restore-luser-env:
[877cc6a]530 @\$(call echo_message, Building)
[962793a]531 @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
532 mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
[877cc6a]533 fi;
[962793a]534 @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
535 mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
[877cc6a]536 fi;
[962793a]537 @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash*
[dbcdfd7]538 @\$(call housekeeping)
[a858a78]539
[7d9a82d]540do_housekeeping:
[4524fb2]541 @-umount \$(MOUNT_PT)/sys
542 @-umount \$(MOUNT_PT)/proc
543 @-umount \$(MOUNT_PT)/dev/shm
544 @-umount \$(MOUNT_PT)/dev/pts
545 @-umount \$(MOUNT_PT)/dev
[045b2dc]546 @-rm /tools
[6ad5a2f]547 @-if [ ! -f luser-exist ]; then \\
548 userdel \$(LUSER); \\
[962793a]549 rm -rf \$(LUSER_HOME); \\
[7d9a82d]550 fi;
[a858a78]551
[fe24ca6]552
[877cc6a]553EOF
554) >> $MKFILE
555
556 # Bring over the items from the Makefile.tmp
557 cat $MKFILE.tmp >> $MKFILE
558 rm $MKFILE.tmp
[c7c5a53]559 echo "Creating Makefile... ${BOLD}DONE${OFF}"
560}
Note: See TracBrowser for help on using the repository browser.