source: LFS/master.sh@ 7933ed7

ablfs-more legacy trunk
Last change on this file since 7933ed7 was 2758d94, checked in by Pierre Labastie <pierre@…>, 6 years ago

Use sect1info for getting informations on LFS packages:

  • add sect1info sections to packagemanager.xml.xxx + various fixes
  • add templates in LFS/lfs.xsl for script start and script end:
    • script start: define variables containing package information

print disk usage
unpack and change dir

  • script end: print disk usage

remove build dir

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