diff --git a/LFS/master.sh b/LFS/master.sh index a000983..41a7c6f 100644 --- a/LFS/master.sh +++ b/LFS/master.sh @@ -100,13 +100,13 @@ chapter5_Makefiles() { # # Drop in the name of the target on a new line, and the previous target # as a dependency. Also call the echo_message function. - LUSER_wrt_target "${this_script}" "$PREV" + wrt_target "${this_script}" "$PREV" # Run the script. # The changingowner script must be run as root. case "${this_script}" in *changingowner) wrt_RunAsRoot "$file" ;; - *) LUSER_wrt_RunAsUser "$file" ;; + *) wrt_RunScript "$file" ;; esac # Include a touch of the target name so make can check @@ -185,29 +185,24 @@ chapter6_Makefiles() { # # Drop in the name of the target on a new line, and the previous target # as a dependency. Also call the echo_message function. - # In the mount of kernel filesystems we need to set LFS - # and not to use chroot. - case "${this_script}" in - *kernfs) LUSER_wrt_target "${this_script}" "$PREV" ;; - *) CHROOT_wrt_target "${this_script}" "$PREV" ;; - esac + wrt_target "${this_script}" "$PREV" # Touch timestamp file if installed files logs will be created. # But only for the firt build when running iterative builds. if [ "$name" != "" ] && [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then - CHROOT_wrt_TouchTimestamp + wrt_TouchTimestamp fi # In the mount of kernel filesystems we need to set LFS # and not to use chroot. case "${this_script}" in - *kernfs) wrt_RunAsRoot "$file" ;; - *) CHROOT_wrt_RunAsRoot "$file" ;; + *kernfs) wrt_RunAsRoot "$file" ;; + *) wrt_RunScript "$file" ;; esac # Write installed files log if [ "$name" != "" ] && [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then - CHROOT_wrt_LogNewFiles "$name" + wrt_LogNewFiles "$name" fi # Include a touch of the target name so make can check @@ -254,33 +249,31 @@ chapter78_Makefiles() { # # Drop in the name of the target on a new line, and the previous target # as a dependency. Also call the echo_message function. - CHROOT_wrt_target "${this_script}" "$PREV" + wrt_target "${this_script}" "$PREV" # For bootscripts and kernel, start INSTALL_LOG if requested case "${this_script}" in *bootscripts | *kernel ) if [ "${INSTALL_LOG}" = "y" ] ; then - CHROOT_wrt_TouchTimestamp - fi ;; + wrt_TouchTimestamp + fi ;; esac # Check if we have a real /etc/fstab file case "${this_script}" in *fstab) if [[ -n $FSTAB ]]; then - CHROOT_wrt_CopyFstab + wrt_CopyFstab else - CHROOT_wrt_RunAsRoot "$file" - fi - ;; - *) CHROOT_wrt_RunAsRoot "$file" - ;; + wrt_RunScript "$file" + fi ;; + *) wrt_RunScript "$file" ;; esac case "${this_script}" in *bootscripts) if [ "${INSTALL_LOG}" = "y" ] ; then - CHROOT_wrt_LogNewFiles "lfs-bootscripts" + wrt_LogNewFiles "lfs-bootscripts" fi ;; *kernel) if [ "${INSTALL_LOG}" = "y" ] ; then - CHROOT_wrt_LogNewFiles "linux" + wrt_LogNewFiles "linux" fi ;; esac diff --git a/common/libs/func_wrt_Makefile b/common/libs/func_wrt_Makefile index 8ad6f3e..8d70898 100644 --- a/common/libs/func_wrt_Makefile +++ b/common/libs/func_wrt_Makefile @@ -17,26 +17,18 @@ wrt_Makefile_header() { # SHELL = /bin/bash -SRC = /sources MOUNT_PT = $BUILDDIR +SCRIPT_ROOT = $SCRIPT_ROOT +CMDSDIR = $PROGNAME-commands +SRC = /sources +SRCSDIR = \$(MOUNT_PT)\$(SRC) +FILELOGDIR = /\$(SCRIPT_ROOT)/$FILELOGDIRBASE + LUSER = $LUSER LGROUP = $LGROUP LHOME = $LHOME -SCRIPT_ROOT = $SCRIPT_ROOT - -BASEDIR = \$(MOUNT_PT) -SRCSDIR = \$(BASEDIR)/sources -CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands -LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$LOGDIRBASE -TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$TESTLOGDIRBASE - -crCMDSDIR = /\$(SCRIPT_ROOT)/$PROGNAME-commands -crLOGDIR = /\$(SCRIPT_ROOT)/$LOGDIRBASE -crTESTLOGDIR = /\$(SCRIPT_ROOT)/$TESTLOGDIRBASE -crFILELOGDIR = /\$(SCRIPT_ROOT)/$FILELOGDIRBASE - -SU_LUSER = su - \$(LUSER) -c LUSER_HOME = \$(LHOME)/\$(LUSER) +SU_LUSER = su - \$(LUSER) -c ADD_REPORT = $REPORT ADD_CUSTOM_TOOLS = $CUSTOM_TOOLS @@ -57,22 +49,7 @@ EOF #==== TARGET HEADER ==== #----------------------------------# -LUSER_wrt_target() { # Create target -#----------------------------------# - local i=$1 - local PREV=$2 -( -cat << EOF - -$i: $PREV - @\$(call echo_message, Building) - @export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID & -EOF -) >> $MKFILE.tmp -} - -#----------------------------------# -CHROOT_wrt_target() { # +wrt_target() { # Create target #----------------------------------# local i=$1 local PREV=$2 @@ -89,10 +66,10 @@ EOF #======================= -#======== RUN AS ======= +#======== RUN THE SCRIPT ======= #----------------------------------# -wrt_RunAsRoot() { # Some scripts must be run as root.. +wrt_RunAsRoot() { # Some not-chroot scripts must be run as root.. #----------------------------------# local MOUNT_ENV local file=$1 @@ -108,13 +85,13 @@ wrt_RunAsRoot() { # Some scripts must be run as root.. ( cat << EOF - @export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/`dirname $file`/\$@ > $LOGDIRBASE/\$@ 2>&1 + @export ${MOUNT_ENV}=\$(MOUNT_PT) && \$(CMDSDIR)/`dirname $file`/\$@ > $LOGDIRBASE/\$@ 2>&1 EOF ) >> $MKFILE.tmp } #----------------------------------# -LUSER_wrt_RunAsUser() { # +wrt_RunScript() { # #----------------------------------# local file=$1 @@ -125,25 +102,13 @@ EOF ) >> $MKFILE.tmp } -#----------------------------------# -CHROOT_wrt_RunAsRoot() { # -#----------------------------------# - local file=$1 -( -cat << EOF - @\$(crCMDSDIR)/`dirname $file`/\$@ > $LOGDIRBASE/\$@ 2>&1 -EOF -) >> $MKFILE.tmp - -} - #======================= #====== COPY FSTAB ===== #----------------------------------# -LUSER_wrt_CopyFstab() { # +LUSER_wrt_CopyFstab() { # Needed for CLFS Sysroot and Embedded #----------------------------------# ( cat << EOF @@ -153,7 +118,7 @@ EOF } #----------------------------------# -CHROOT_wrt_CopyFstab() { # +wrt_CopyFstab() { # #----------------------------------# ( cat << EOF @@ -168,7 +133,7 @@ EOF #==== INSTALLED FILES LOGS ==== #----------------------------------# -LUSER_wrt_TouchTimestamp() { # +LUSER_wrt_TouchTimestamp() { # Needed for CLFS Sysroot and Embedded #----------------------------------# ( cat << EOF @@ -178,7 +143,7 @@ EOF } #----------------------------------# -CHROOT_wrt_TouchTimestamp() { # +wrt_TouchTimestamp() { # #----------------------------------# ( cat << EOF @@ -188,7 +153,7 @@ EOF } #----------------------------------# -LUSER_wrt_LogNewFiles() { # +LUSER_wrt_LogNewFiles() { # Needed for CLFS Sysroot and Embedded #----------------------------------# local name=$1 ( @@ -199,7 +164,7 @@ EOF } #----------------------------------# -CHROOT_wrt_LogNewFiles() { # +wrt_LogNewFiles() { # #----------------------------------# local name=$1 ( diff --git a/common/makefile-functions b/common/makefile-functions index 39a1f8d..0eb0ce3 100644 --- a/common/makefile-functions +++ b/common/makefile-functions @@ -83,13 +83,13 @@ endef define log_new_files @find / -xdev ! -path "/$(SCRIPT_ROOT)/*" ! -path "/tmp/*" ! -path "$(SRC)/*" \ -newer $(SRC)/timestamp-marker -not -type d \ - -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(crFILELOGDIR)/$(1) + -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(FILELOGDIR)/$(1) endef define log_new_files_LUSER - @find $(BASEDIR) -xdev ! -path "$(BASEDIR)/$(SCRIPT_ROOT)/*" ! -path "$(BASEDIR)/tmp/*" ! -path "$(SRCSDIR)/*" \ + @find $(MOUNT_PT) -xdev ! -path "$(MOUNT_PT)/$(SCRIPT_ROOT)/*" ! -path "$(MOUNT_PT)/tmp/*" ! -path "$(SRCSDIR)/*" \ -newer $(SRCSDIR)/timestamp-marker -not -type d \ - -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(BASEDIR)$(crFILELOGDIR)/$(1) + -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(MOUNT_PT)$(FILELOGDIR)/$(1) endef #======================= @@ -101,8 +101,9 @@ define echo_report echo ; \ echo $(BOLD) The report file $(BLUE)$(1)$(BOLD) has been created ; \ echo ; \ - echo $(WHITE)Please send the $(BOLD)$(MOUNT_PT)/jhalfs/$(1)$(WHITE) ; \ - echo file to $(BOLD)manuel@linuxfromscratch.org$(WHITE) ; \ + echo $(WHITE)If this is a development book build, please send the ; \ + echo $(BOLD)$(MOUNT_PT)/$(SCRIPT_ROOT)/$(1)$(WHITE) file to ; \ + echo $(BOLD)manuel@linuxfromscratch.org$(WHITE) ; \ echo ; \ echo That will help us to keep more accurate SBU and ; \ echo disk usage values into the book. Thanks. ; \ @@ -167,7 +168,7 @@ define echo_boot_finished @echo 1.If it is necessary, transfer the newly created partition to the target machine @echo 2.Boot the new partition. @echo 3.Once you are logged in issue the following commands - @echo $(tab_) $(BOLD)cd /jhalfs + @echo $(tab_) $(BOLD)cd /$(SCRIPT_ROOT) @echo $(tab_) $(BOLD)make makesys @echo The build process should resume. Follow any instructions that appear. @echo --------------------------------------------------------------------------------