source: LFS/master.sh@ a659e46

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

Hopefully get the devices: target Ok now

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