source: LFS/master.sh@ 608fbe1

2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 608fbe1 was 7831c79, checked in by Pierre Labastie <pierre@…>, 13 years ago

Added check to the list
of packages which are not built if testsuites are not run

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