diff --git a/CLFS/master.sh b/CLFS/master.sh index a1dcc80..bffecbb 100755 --- a/CLFS/master.sh +++ b/CLFS/master.sh @@ -784,6 +784,9 @@ bootable_Makefiles() { # done + # Add SBU-disk_usage report target if required + if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi + } @@ -861,6 +864,9 @@ bm_bootable_Makefiles() { # done + # Add SBU-disk_usage report target if required + if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi + } diff --git a/HLFS/master.sh b/HLFS/master.sh index a105a41..8dd37bd 100755 --- a/HLFS/master.sh +++ b/HLFS/master.sh @@ -498,6 +498,9 @@ EOF # Keep the script file name for Makefile dependencies. PREV=$this_script done # for file in chapter07/* + + # Add SBU-disk_usage report target if required + if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi } diff --git a/LFS/master.sh b/LFS/master.sh index 1ecb73a..a2cb04f 100755 --- a/LFS/master.sh +++ b/LFS/master.sh @@ -287,6 +287,9 @@ chapter789_Makefiles() { # Keep the script file name for Makefile dependencies. PREV=${this_script} done # for file in chapter0{7,8,9}/* + + # Add SBU-disk_usage report target if required + if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi } diff --git a/common/common-functions b/common/common-functions index 3c42477..28553b8 100644 --- a/common/common-functions +++ b/common/common-functions @@ -390,6 +390,24 @@ EOF } +#----------------------------------# +wrt_report() { # +#----------------------------------# +( +cat << EOF + +create-sbu_du-report: $PREV + @\$(call echo_message, Building) + @./create-sbu_du-report.sh logs $VERSION $TEST + @\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report) + @touch \$@ +EOF +) >> $MKFILE.tmp + +chapter789="$chapter789 create-sbu_du-report" +} + + #----------------------------# run_make() { #----------------------------# diff --git a/common/config b/common/config index 897a4e6..4c73501 100644 --- a/common/config +++ b/common/config @@ -36,6 +36,10 @@ RUNMAKE=0 # (in CLFS, alias to 2) TEST=1 +# Create SBU and disk usage report 0(no)/1(yes) +# NOTE: requires to have bc installed on the host +REPORT=1 + #--- Run the stripping phases 0(no)/1(yes) STRIP=1 diff --git a/common/func_validate_configs.sh b/common/func_validate_configs.sh index 77d1efe..c147f93 100644 --- a/common/func_validate_configs.sh +++ b/common/func_validate_configs.sh @@ -83,10 +83,10 @@ validate_config() { # Are the config values sane (within reason) inline_doc # First internal variables, then the ones that change the book's flavour, and lastly system configuration variables - local -r blfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG DEPEND TEST" - local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE MODEL GRSECURITY_HOST TEST STRIP FSTAB CONFIG KEYMAP PAGE TIMEZONE LANG LC_ALL" - local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE METHOD ARCH TARGET TEST STRIP FSTAB BOOT_CONFIG CONFIG KEYMAP VIMLANG PAGE TIMEZONE LANG" - local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE TEST STRIP FSTAB CONFIG VIMLANG PAGE TIMEZONE LANG" + local -r blfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG DEPEND TEST" + local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE MODEL GRSECURITY_HOST TEST REPORT STRIP FSTAB CONFIG KEYMAP PAGE TIMEZONE LANG LC_ALL" + local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE METHOD ARCH TARGET TEST REPORT STRIP FSTAB BOOT_CONFIG CONFIG KEYMAP VIMLANG PAGE TIMEZONE LANG" + local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE TEST REPORT STRIP FSTAB CONFIG VIMLANG PAGE TIMEZONE LANG" local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,' local -r ERROR_MSG_pt2=' check the config file ${BOLD}${GREEN}\<$(echo $PROGNAME | tr [a-z] [A-Z])/config\> or \${OFF}' @@ -131,6 +131,15 @@ inline_doc HPKG) validation_str="x0x x1x"; validate_str; continue ;; RUNMAKE) validation_str="x0x x1x"; validate_str; continue ;; TEST) validation_str="x0x x1x x2x x3x"; validate_str; continue ;; + REPORT) validation_str="x0x x1x"; validate_str; + if [[ "${!config_param}" = "1" ]] && [[ `type -p bc` ]]; then + continue + else + echo -e " ${BOLD}The bc binary was not found${OFF}" + echo -e " The SBU and disk usage report creation will be skiped" + REPORT=0 + continue + fi ;; STRIP) validation_str="x0x x1x"; validate_str; continue ;; VIMLANG) validation_str="x0x x1x"; validate_str; continue ;; DEPEND) validation_str="x0x x1x x2x"; validate_str; continue ;; diff --git a/common/makefile-functions b/common/makefile-functions index 2a62397..e0975d6 100644 --- a/common/makefile-functions +++ b/common/makefile-functions @@ -30,6 +30,17 @@ define unpack3 tar -xvf `ls -t $(1) | head -n1` > /tmp/unpacked endef +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 + @echo That will help us to keep more accurate SBU and + @echo disk usage values into the book. Thanks. +endef + define echo_finished @echo $(BOLD) @echo -------------------------------------------------------------------------------- diff --git a/master.sh b/master.sh index bcfbf49..e3d7fc0 100755 --- a/master.sh +++ b/master.sh @@ -460,6 +460,7 @@ if [[ "$PWD" != "$JHALFSDIR" ]]; then cp $FILES $JHALFSDIR/ popd 1> /dev/null fi + [[ "$REPORT" = "1" ]] && cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/ sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL} export XSL=$JHALFSDIR/${XSL} fi