source: LFS/master.sh@ 2e1c1c3

ablfs-more legacy trunk
Last change on this file since 2e1c1c3 was 2e1c1c3, checked in by Pierre Labastie <pierre@…>, 7 years ago

Remove spaces at the end of lines

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