From 3e7ceed25607cfc89dd73fcf1874d77ce479333d Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Fri, 15 Dec 2006 10:53:10 +0000 Subject: [PATCH] Ported CUSTOM_TOOLS support to all books. --- CLFS/master.sh | 56 +++++++++---- CLFS2/master.sh | 35 +++++--- CLFS3/master.sh | 23 ++++-- Config.in | 6 +- HLFS/master.sh | 35 +++++--- LFS/master.sh | 33 +++++--- README | 3 + README.CLFS | 29 +++++++ README.CUSTOM | 6 -- common/libs/func_blfs_deps | 1 + common/libs/func_custom_pkgs | 114 ++++++++++++--------------- common/libs/func_validate_configs.sh | 12 +-- common/libs/func_wrt_Makefile | 5 +- common/makefile-functions | 5 +- jhalfs | 66 +++++++--------- 15 files changed, 254 insertions(+), 175 deletions(-) create mode 100644 README.CLFS diff --git a/CLFS/master.sh b/CLFS/master.sh index 977d154..d3e8fdd 100644 --- a/CLFS/master.sh +++ b/CLFS/master.sh @@ -731,6 +731,8 @@ set -e bootscripts_Makefiles # mk_BOOTSCRIPT (CHROOT) $bootscripttools bootable_Makefiles # mk_BOOTABLE (CHROOT) $bootabletools + # Add the CUSTOM_TOOLS targets, if needed + [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target # Add the BLFS_TOOL targets, if needed [[ "$BLFS_TOOL" = "y" ]] && wrt_blfs_tool_targets @@ -764,7 +766,7 @@ if [[ "${METHOD}" = "chroot" ]]; then ( cat << EOF -all: ck_UID mk_SETUP mk_CROSS mk_SUDO mk_SYSTOOLS create-sbu_du-report mk_BLFS_TOOL +all: ck_UID mk_SETUP mk_CROSS mk_SUDO mk_SYSTOOLS create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL @sudo make do-housekeeping @echo "$VERSION - jhalfs build" > clfs-release && \\ sudo mv clfs-release \$(MOUNT_PT)/etc @@ -815,19 +817,30 @@ mk_SYSTOOLS: mk_SUDO @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make CHROOT_JAIL") @touch \$@ -mk_BLFS_TOOL: create-sbu_du-report - @\$(call echo_PHASE,Building BLFS-TOOLS) +mk_CUSTOM_TOOLS: create-sbu_du-report + @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\ + \$(call echo_PHASE,Building CUSTOM_TOOLS); \\ + \$(call echo_CHROOT_request); \\ + sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\ + (sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make CUSTOM_TOOLS"); \\ + fi; + @touch \$@ + +mk_BLFS_TOOL: mk_CUSTOM_TOOLS @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\ + \$(call echo_PHASE,Building BLFS_TOOL); \\ + \$(call echo_CHROOT_request); \\ sudo mkdir -p $BUILDDIR$TRACKING_DIR; \\ sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BLFS_TOOL"; \\ fi; @touch \$@ -SETUP: $host_prep -AS_LUSER: $cross_tools $temptools -SUDO: $orphan_scripts -CHROOT_JAIL: ${chroottools} $testsuitetools $basicsystem $bootscripttools $bootabletools -BLFS_TOOL: $blfs_tool +SETUP: $host_prep +AS_LUSER: $cross_tools $temptools +SUDO: $orphan_scripts +CHROOT_JAIL: ${chroottools} $testsuitetools $basicsystem $bootscripttools $bootabletools +CUSTOM_TOOLS: $custom_list +BLFS_TOOL: $blfs_tool create-sbu_du-report: mk_SYSTOOLS @@ -866,7 +879,7 @@ all: ck_UID mk_SETUP mk_CROSS mk_SUDO @sudo make do-housekeeping @\$(call echo_boot_finished,$VERSION) -makesys: mk_FINAL mk_BLFS_TOOL +makesys: mk_FINAL mk_CUSTOM_TOOLS mk_BLFS_TOOL @echo "$VERSION - jhalfs build" > /etc/clfs-release @\$(call echo_finished,$VERSION) @@ -908,19 +921,28 @@ mk_FINAL: @( source /root/.bash_profile && make AS_ROOT ) @touch \$@ -mk_BLFS_TOOL: mk_FINAL - @\$(call echo_PHASE,Building BLFS-TOOLS) +mk_CUSTOM_TOOLS: mk_FINAL + @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\ + mkdir -p ${TRACKING_DIR}; \\ + \$(call echo_PHASE,Building CUSTOM_TOOLS); \\ + ( source /root/.bash_profile && make CUSTOM_TOOLS"); \\ + fi; + @touch \$@ + +mk_BLFS_TOOL: mk_CUSTOM_TOOLS @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\ mkdir -p $TRACKING_DIR; \\ - ( make BLFS_TOOL ); \\ + \$(call echo_PHASE,Building BLFS_TOOL); \\ + ( source /root/.bash_profile && make BLFS_TOOL ); \\ fi @touch \$@ -SETUP: $host_prep -AS_LUSER: $cross_tools $temptools ${boottools} -SUDO: $orphan_scripts -AS_ROOT: $testsuitetools $basicsystem $bootscripttools $bootabletools -BLFS_TOOL: $blfs_tool +SETUP: $host_prep +AS_LUSER: $cross_tools $temptools ${boottools} +SUDO: $orphan_scripts +AS_ROOT: $testsuitetools $basicsystem $bootscripttools $bootabletools +CUSTOM_TOOLS: $custom_list +BLFS_TOOL: $blfs_tool do-housekeeping: @-rm /tools /cross-tools diff --git a/CLFS2/master.sh b/CLFS2/master.sh index 85057be..f90428c 100644 --- a/CLFS2/master.sh +++ b/CLFS2/master.sh @@ -408,9 +408,10 @@ build_Makefile() { # Construct a Makefile from the book scripts final_system_Makefiles # $basicsystem bootscripts_Makefiles # $bootscripttools bootable_Makefiles # $bootable - # Add the BLFS_TOOL targets, if needed. Clean PREV to prevent that - # the first dependency script will depend on *-chowning - [[ "$BLFS_TOOL" = "y" ]] && PREV="" && wrt_blfs_tool_targets + # Add the CUSTOM_TOOLS targets, if needed + [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target + # Add the BLFS_TOOL targets, if needed. + [[ "$BLFS_TOOL" = "y" ]] && wrt_blfs_tool_targets # Add a header, some variables and include the function file # to the top of the real Makefile. @@ -421,7 +422,7 @@ build_Makefile() { # Construct a Makefile from the book scripts ( cat << EOF -all: ck_UID mk_SETUP mk_LUSER create-sbu_du-report mk_BLFS_TOOL mk_ROOT +all: ck_UID mk_SETUP mk_LUSER create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL mk_ROOT @sudo make restore-luser-env @sudo make do-housekeeping @\$(call echo_finished,$VERSION) @@ -444,24 +445,36 @@ mk_LUSER: mk_SETUP @(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make SHELL=/bin/bash LUSER" ) @touch \$@ -mk_BLFS_TOOL: create-sbu_du-report - @\$(call echo_PHASE,Building BLFS-TOOLS) +mk_CUSTOM_TOOLS: create-sbu_du-report @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\ + \$(call echo_PHASE,Building CUSTOM_TOOLS); \\ + \$(call echo_SULUSER_request); \\ + (sudo \$(SU_LUSER) "mkdir -p $BUILDDIR$TRACKING_DIR"); \\ + (sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make SHELL=/bin/bash CUSTOM_TOOLS"); \\ + fi; + @touch \$@ + +mk_BLFS_TOOL: mk_CUSTOM_TOOLS + @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\ + \$(call echo_PHASE,Building BLFS_TOOL); \\ + \$(call echo_SULUSER_request); \\ (sudo \$(SU_LUSER) "mkdir -p $BUILDDIR$TRACKING_DIR"); \\ (sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make SHELL=/bin/bash BLFS_TOOL"); \\ fi; @touch \$@ -mk_ROOT: +mk_ROOT: mk_BLFS_TOOL + @\$(call echo_SU_request) @echo "$VERSION-sysroot - jhalfs build" > clfs-release && \\ sudo mv clfs-release \$(MOUNT_PT)/etc @sudo make SHELL=/bin/bash ROOT @touch \$@ -SETUP: $host_prep -LUSER: $cross_tools $basicsystem $bootscripttools $bootable -BLFS_TOOL: $blfs_tool -ROOT: $chowning +SETUP: $host_prep +LUSER: $cross_tools $basicsystem $bootscripttools $bootable +CUSTOM_TOOLS: $custom_list +BLFS_TOOL: $blfs_tool +ROOT: $chowning create-sbu_du-report: mk_LUSER diff --git a/CLFS3/master.sh b/CLFS3/master.sh index fffc2fd..71794ee 100644 --- a/CLFS3/master.sh +++ b/CLFS3/master.sh @@ -411,6 +411,8 @@ build_Makefile() { # Construct a Makefile from the book scripts final_system_Makefiles # $basicsystem bootscripts_Makefiles # $bootscripttools bootable_Makefiles # $bootable + # Add the CUSTOM_TOOLS targets, if needed + [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target # Add a header, some variables and include the function file # to the top of the real Makefile. @@ -421,7 +423,7 @@ build_Makefile() { # Construct a Makefile from the book scripts ( cat << EOF -all: ck_UID mk_SETUP mk_LUSER create-sbu_du-report mk_ROOT +all: ck_UID mk_SETUP mk_LUSER create-sbu_du-report mk_CUSTOM_TOOLS mk_ROOT @sudo make restore-luser-env @sudo make do-housekeeping @\$(call echo_finished,$VERSION) @@ -444,16 +446,27 @@ mk_LUSER: mk_SETUP @(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make SHELL=/bin/bash LUSER" ) @touch \$@ -mk_ROOT: +mk_CUSTOM_TOOLS: create-sbu_du-report + @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\ + \$(call echo_PHASE,Building CUSTOM_TOOLS); \\ + \$(call echo_SULUSER_request); \\ + (sudo \$(SU_LUSER) "mkdir -p $BUILDDIR$TRACKING_DIR"); \\ + (sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make SHELL=/bin/bash CUSTOM_TOOLS"); \\ + fi; + @touch \$@ + +mk_ROOT: mk_CUSTOM_TOOLS + @\$(call echo_SU_request) @echo "$VERSION-embedded - jhalfs build" > clfs-release && \\ sudo mv clfs-release \$(MOUNT_PT)/etc @sudo make SHELL=/bin/bash ROOT @touch \$@ -SETUP: $host_prep -LUSER: $cross_tools $basicsystem $bootscripttools $bootable -ROOT: $chowning +SETUP: $host_prep +LUSER: $cross_tools $basicsystem $bootscripttools $bootable +CUSTOM_TOOLS: $custom_list +ROOT: $chowning create-sbu_du-report: mk_LUSER diff --git a/Config.in b/Config.in index fcf16f1..b41f0d2 100644 --- a/Config.in +++ b/Config.in @@ -316,12 +316,12 @@ menu "--- BOOK Settings" #--- Custom Tools support config CUSTOM_TOOLS - bool "Add custom tool support" + bool "Add custom tools support" default n - depends on BOOK_LFS + depends on !BOOK_BLFS help #--- Activating this option additional packages you create - # will be installed. + # will be installed after finished the xLFS system build. # #--- End Custom Tools support diff --git a/HLFS/master.sh b/HLFS/master.sh index 0774717..3f8ec29 100644 --- a/HLFS/master.sh +++ b/HLFS/master.sh @@ -494,6 +494,10 @@ build_Makefile() { # Construct a Makefile from the book scripts # Add the iterations targets, if needed [[ "$COMPARE" = "y" ]] && wrt_compare_targets chapter7_Makefiles + # Add the CUSTOM_TOOLS targets, if needed + [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target + # Add the BLFS_TOOL targets, if needed + [[ "$BLFS_TOOL" = "y" ]] && wrt_blfs_tool_targets # Add a header, some variables and include the function file # to the top of the real Makefile. @@ -526,7 +530,7 @@ build_Makefile() { # Construct a Makefile from the book scripts ( cat << EOF -all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL +all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL @sudo make do-housekeeping @echo "$VERSION - jhalfs build" > hlfs-release && \\ sudo install -m444 hlfs-release \$(MOUNT_PT)/etc/hlfs-release @@ -578,21 +582,32 @@ mk_BOOT: mk_CHROOT @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BOOT") @touch \$@ -mk_BLFS_TOOL: create-sbu_du-report - @\$(call echo_PHASE,Building BLFS-TOOLS) +mk_CUSTOM_TOOLS: create-sbu_du-report + @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\ + \$(call echo_PHASE,Building CUSTOM_TOOLS); \\ + \$(call echo_CHROOT_request); \\ + sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\ + (sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make CUSTOM_TOOLS"); \\ + fi; + @touch \$@ + +mk_BLFS_TOOL: mk_CUSTOM_TOOLS @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\ + \$(call echo_PHASE,Building BLFS_TOOL); \\ + \$(call echo_CHROOT_request); \\ sudo mkdir -p $BUILDDIR$TRACKING_DIR; \\ - sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BLFS_TOOL"; \\ + (sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BLFS_TOOL"); \\ fi; @touch \$@ -SETUP: $chapter3 -LUSER: $chapter5 -SUDO: $runasroot -CHROOT: $chapter6 -BOOT: $chapter7 -BLFS_TOOL: $blfs_tool +SETUP: $chapter3 +LUSER: $chapter5 +SUDO: $runasroot +CHROOT: $chapter6 +BOOT: $chapter7 +CUSTOM_TOOLS: $custom_list +BLFS_TOOL: $blfs_tool create-sbu_du-report: mk_BOOT diff --git a/LFS/master.sh b/LFS/master.sh index 01aa98c..2dbfda4 100644 --- a/LFS/master.sh +++ b/LFS/master.sh @@ -374,6 +374,8 @@ build_Makefile() { # # Add the iterations targets, if needed [[ "$COMPARE" = "y" ]] && wrt_compare_targets chapter78_Makefiles + # Add the CUSTOM_TOOLS targets, if needed + [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target # Add the BLFS_TOOL targets, if needed [[ "$BLFS_TOOL" = "y" ]] && wrt_blfs_tool_targets @@ -406,7 +408,7 @@ build_Makefile() { # ( cat << EOF -all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL +all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL @sudo make do_housekeeping @echo "$VERSION - jhalfs build" > lfs-release && \\ sudo mv lfs-release \$(MOUNT_PT)/etc @@ -458,21 +460,32 @@ mk_BOOT: mk_CHROOT @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BOOT") @touch \$@ -mk_BLFS_TOOL: create-sbu_du-report - @\$(call echo_PHASE,Building BLFS-TOOLS) +mk_CUSTOM_TOOLS: create-sbu_du-report + @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\ + \$(call echo_PHASE,Building CUSTOM_TOOLS); \\ + \$(call echo_CHROOT_request); \\ + sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\ + (sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make CUSTOM_TOOLS"); \\ + fi; + @touch \$@ + +mk_BLFS_TOOL: mk_CUSTOM_TOOLS @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\ + \$(call echo_PHASE,Building BLFS_TOOL); \\ + \$(call echo_CHROOT_request); \\ sudo mkdir -p $BUILDDIR$TRACKING_DIR; \\ - sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BLFS_TOOL"; \\ + (sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BLFS_TOOL"); \\ fi; @touch \$@ -SETUP: $chapter4 -LUSER: $chapter5 -SUDO: $runasroot -CHROOT: $chapter6 -BOOT: $chapter78 -BLFS_TOOL: $blfs_tool +SETUP: $chapter4 +LUSER: $chapter5 +SUDO: $runasroot +CHROOT: $chapter6 +BOOT: $chapter78 +CUSTOM_TOOLS: $custom_list +BLFS_TOOL: $blfs_tool create-sbu_du-report: mk_BOOT diff --git a/README b/README index 9d10203..6fcb3ac 100644 --- a/README +++ b/README @@ -24,6 +24,9 @@ $Id$ configuration of the uClibc package when building a HLFS system using uClibc rather than glibc. + *. Read carefully this file and the other README.* files before start + using the tool. + 2. PREREQUISITES:: To use this tool you MUST: diff --git a/README.CLFS b/README.CLFS new file mode 100644 index 0000000..12005fa --- /dev/null +++ b/README.CLFS @@ -0,0 +1,29 @@ +# $Id$ + + CLFS-1.x NOTES + + None for now. + + + + CLFS SYSROOT METHOD NOTES + + None for now. + + + + CLFS EMBEDDED SYSTEMS NOTES + + .- To install CBLFS packages you must to use the "Add custom tools support" + feature. To learn how it works and how to use it, see the section titled + "Adding Post-System Build Configuration Files and Extra Packages" + found in README.CUSTOM. That is also applicable to bootloaders installation. + + .- If your target is a MIPS wireless router, you must to use the "Rebuild + Makefile" feature to install wireless tools. To learn how it works and how + to use it, see the section titled "Base System Customization" found in + README.CUSTOM + + .- The backup & clean-up phases aren't run. This is to allow users to + review the installed files and do a more in-deeper clan-up before creating + the system tarball. \ No newline at end of file diff --git a/README.CUSTOM b/README.CUSTOM index 456541a..6896cdf 100644 --- a/README.CUSTOM +++ b/README.CUSTOM @@ -147,12 +147,6 @@ configuration file which enables/disables the inclusion of personal scripts. file and NOT in the package script. The gpm script is included as an example of multiple patch files and the need for a blfs bootscript. - RUNNING::: - Although your scripts are added to the generated makefile they are not - automatically built. You must tell the makefile to build the tools with - the cmd - make mk_CUSTOM_TOOLS - #--------- GLIB example ----------- diff --git a/common/libs/func_blfs_deps b/common/libs/func_blfs_deps index 922cd7e..1c7fd50 100644 --- a/common/libs/func_blfs_deps +++ b/common/libs/func_blfs_deps @@ -117,6 +117,7 @@ copy_blfs_deps_scripts() { # method avoid to place the test on all #----------------------------------# wrt_blfs_tool_targets() { # #----------------------------------# + PREV="" echo "${tab_}${GREEN}Processing... ${L_arrow}BLFS_TOOL ${R_arrow}" diff --git a/common/libs/func_custom_pkgs b/common/libs/func_custom_pkgs index b12d2b6..d865f98 100644 --- a/common/libs/func_custom_pkgs +++ b/common/libs/func_custom_pkgs @@ -3,53 +3,38 @@ # $Id$ #----------------------------------# -add_CustomTools() { # Add any users supplied scripts +wrt_CustomTools_target() { # Add any users supplied scripts #----------------------------------# - PREV_SCRIPT="" - CUSTOM_LIST="" + PREV="" - echo "Adding custom packages... ${BOLD}START${OFF}" + echo " Adding custom packages... ${BOLD}START${OFF}" - cd $JHALFSDIR - > ${MKFILE}.tmp2 + # Create the custom_tools scripts directory + mkdir -p custom-tools - # First some build commands and a placeholder for the build list. - # This will not cause problems if there are no custom scripts. -( cat << xEOFx - - -mk_CUSTOM_TOOLS: - @\$(call echo_CHROOT_request) - @ sudo mkdir -p ${BUILDDIR}${TRACKING_DIR} - @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make CUSTOM_TOOLS") - @touch \$@ - -CUSTOM_TOOLS: -xEOFx -) >> ${MKFILE}.tmp2 - - - for this_script in custom-commands/config/*; do - if [[ `basename ${this_script}` = "*" ]]; then + for file in $JHALFSDIR/custom-commands/*; do + if [[ `basename ${file}` = "*" ]]; then break fi - source $this_script - THIS_SCRIPT=$(basename ${this_script}) - echo "$tab_${GREEN}Adding${OFF} ${THIS_SCRIPT}" + source $file + this_script=$(basename ${file}) + echo "$tab_${GREEN}Adding${OFF} ${this_script}" # Create a Makefile entry if [[ "x${PKG}" = "x" ]]; then - # Create an entry for a self contained cmd script that does not reference a package tarball -( cat << EOF - -${THIS_SCRIPT}: ${PREV_SCRIPT} - @\$(call echo_message, Building) - @./progress_bar.sh \$@ \$\$PPID & - @( time { source envars && /\$(SCRIPT_ROOT)/custom-commands/scripts/${THIS_SCRIPT} >>logs/${THIS_SCRIPT} 2>&1 ; } ) 2>>logs/${THIS_SCRIPT} - @touch \$@ - @\$(call housekeeping) -EOF -) >> ${MKFILE}.tmp2 + # Create an entry for a self contained cmd script that does not + # reference a package tarball + case $PROGNAME in + clfs2 | clfs3 ) + LUSER_wrt_target "${this_script}" "$PREV" + LUSER_wrt_RunAsUser "custom-tools/${this_script}" + ;; + *) + CHROOT_wrt_target "${this_script}" "$PREV" + CHROOT_wrt_RunAsRoot "custom-tools/${this_script}" + ;; + esac + wrt_touch # Create the build script file ( cat <<- xEOFx @@ -59,25 +44,27 @@ set -e `cat tmp` exit xEOFx -) > custom-commands/scripts/$THIS_SCRIPT +) > custom-tools/${this_script} else # Create an entry for package -( cat << EOF - -${THIS_SCRIPT}: ${PREV_SCRIPT} - @\$(call echo_message, Building) - @./progress_bar.sh \$@ \$\$PPID & - @\$(call remove_existing_dirs2,${PKG_FILE}) - @\$(call unpack2,${PKG_FILE}) - @\$(call get_pkg_root2) - @( time { source envars && /\$(SCRIPT_ROOT)/custom-commands/scripts/${THIS_SCRIPT} >>logs/${THIS_SCRIPT} 2>&1 ; } ) 2>>logs/${THIS_SCRIPT} - @\$(call remove_build_dirs2,${PKG}) - @touch \$@ - @touch ${TRACKING_DIR}/${PKG}-${PKG_VERSION} - @\$(call housekeeping) -EOF -) >> ${MKFILE}.tmp2 + case $PROGNAME in + clfs2 | clfs3 ) + LUSER_wrt_target "${this_script}" "$PREV" + LUSER_wrt_unpack "${PKG_FILE}" + LUSER_wrt_RunAsUser "custom-tools/${this_script}" + LUSER_RemoveBuildDirs "${PKG}" + echo -e "\t@touch \$(MOUNT_PT)$TRACKING_DIR/${PKG}-${PKG_VERSION}" >> $MKFILE.tmp + ;; + *) + CHROOT_wrt_target "${this_script}" "$PREV" + CHROOT_Unpack "${PKG_FILE}" + CHROOT_wrt_RunAsRoot "custom-tools/${this_script}" + CHROOT_wrt_RemoveBuildDirs "${PKG}" + echo -e "\t@touch $TRACKING_DIR/${PKG}-${PKG_VERSION}" >> $MKFILE.tmp + ;; + esac + wrt_touch # Create the build script file ( cat <<- xEOFx @@ -88,22 +75,19 @@ cd \$PKGDIR `cat tmp` exit xEOFx -) > custom-commands/scripts/$THIS_SCRIPT +) > custom-tools/$this_script fi - chmod 755 custom-commands/scripts/$THIS_SCRIPT rm -f tmp - PREV_SCRIPT=$THIS_SCRIPT - CUSTOM_LIST="${CUSTOM_LIST}${THIS_SCRIPT} " + PREV=$this_script + custom_list="${custom_list} ${this_script}" done - # Add the dependancy list. - sed "s|^CUSTOM_TOOLS:|CUSTOM_TOOLS: ${CUSTOM_LIST}|" -i ${MKFILE}.tmp2 - cat ${MKFILE}.tmp2 >> ${MKFILE} - rm ${MKFILE}.tmp2 - echo "Adding custom packages... ${BOLD}DONE${OFF}" -} + # Make the scripts executable. + chmod +x custom-tools/* + echo " Adding custom packages... ${BOLD}DONE${OFF}" +} #----------------------------------# @@ -114,7 +98,7 @@ add_CustomToolsURLS() { # Add any users supplied scripts URL informat local URL PKG PKG_VERSION PKG_FILE MD5 > urls.lst.tmp - for this_script in $JHALFSDIR/custom-commands/config/*; do + for this_script in $JHALFSDIR/custom-commands/*; do if [[ `basename ${this_script}` = "*" ]]; then CUSTOM_TOOLS="n" break diff --git a/common/libs/func_validate_configs.sh b/common/libs/func_validate_configs.sh index a375ef6..008b537 100644 --- a/common/libs/func_validate_configs.sh +++ b/common/libs/func_validate_configs.sh @@ -20,21 +20,21 @@ 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 hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL PAGE TIMEZONE LANG LC_ALL LUSER LGROUP BLFS_TOOL REBUILD_MAKEFILE" - local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TARGET32 TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL REBUILD_MAKEFILE" - local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET REPORT STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL REBUILD_MAKEFILE" - local -r clfs3_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET MIPS_LEVEL REPORT STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP REBUILD_MAKEFILE" + local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL PAGE TIMEZONE LANG LC_ALL LUSER LGROUP BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE" + local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TARGET32 TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE" + local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET REPORT STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE" + local -r clfs3_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET MIPS_LEVEL REPORT STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP CUSTOM_TOOLS REBUILD_MAKEFILE" local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE" local -r blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR" - local -r blfs_tool_PARAM_LIST="BLFS_BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR DEP_LIBXML DEP_LIBXSLT DEP_TIDY DEP_UNZIP DEP_DBXML DEP_DBXSL DEP_LINKS DEP_SUDO DEP_WGET DEP_SVN DEP_GPM" + local -r blfs_tool_PARAM_LIST="BLFS_BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR DEP_LIBXML DEP_LIBXSLT DEP_TIDY DEP_UNZIP DEP_DBXML DEP_DBXSL DEP_LINKS DEP_SUDO DEP_WGET DEP_SVN DEP_GPM" local -r custom_tool_PARAM_LIST="TRACKING_DIR" 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='rerun make and fix your configuration settings${OFF}' local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}' - local PARAM_LIST= + local PARAM_LIST= local config_param local validation_str local save_param diff --git a/common/libs/func_wrt_Makefile b/common/libs/func_wrt_Makefile index 0a3080e..2fd065d 100644 --- a/common/libs/func_wrt_Makefile +++ b/common/libs/func_wrt_Makefile @@ -37,8 +37,9 @@ LUSER_HOME = /home/\$(LUSER) PRT_DU = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found \$(MOUNT_PT) \`\n" PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found / \`\n" -ADD_REPORT = $REPORT -ADD_BLFS_TOOLS = $BLFS_TOOL +ADD_REPORT = $REPORT +ADD_CUSTOM_TOOLS = $CUSTOM_TOOLS +ADD_BLFS_TOOLS = $BLFS_TOOL export PATH := \${PATH}:/usr/sbin diff --git a/common/makefile-functions b/common/makefile-functions index 9a098a5..fdcd503 100644 --- a/common/makefile-functions +++ b/common/makefile-functions @@ -18,7 +18,6 @@ nl_ = "" #==== BUILD MESSAGES === define echo_PHASE - @clear @echo $(BOLD)-------------------------------------------------------------------------------- @echo $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts @echo $(BOLD)-------------------------------------------------------------------------------- @@ -33,15 +32,13 @@ define echo_SU_request endef define echo_SULUSER_request - @clear @echo $(BOLD)-------------------------------------------------------------------------------- @echo $(BOLD)$(BLUE)$@ @echo $(WHITE)You are going to log into the user account $(BOLD)$(YELLOW)$(LUSER)$(OFF) - @echo su requires a password + @echo sudo requires a password endef define echo_CHROOT_request - @clear @echo $(BOLD)-------------------------------------------------------------------------------- @echo $(BOLD)$(BLUE)$@ @echo $(WHITE)You are going to CHROOT into $(MOUNT_PT) $(BOLD)$(YELLOW)$(LUSER)$(OFF) diff --git a/jhalfs b/jhalfs index 59d272f..109fc1a 100755 --- a/jhalfs +++ b/jhalfs @@ -332,7 +332,7 @@ if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then if [[ ! -d $JHALFSDIR ]]; then mkdir -p $JHALFSDIR fi - # + # Create $BUILDDIR/sources even though it could be created by get_sources() if [[ ! -d $BUILDDIR/sources ]]; then mkdir -p $BUILDDIR/sources @@ -344,34 +344,21 @@ if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then fi >$LOGDIR/$LOG # + # Copy common helper files + cp $COMMON_DIR/{makefile-functions,progress_bar.sh,packages.xsl} $JHALFSDIR/ + # + # Fix the XSL book parser + sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL} + export XSL=$JHALFSDIR/${XSL} + # + + # Copy urls.xsl, if needed + [[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/ + # + # Create the test-log directory, if needed [[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR # - cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/ - # - [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/ - # - if [[ "$COMPARE" = "y" ]]; then - mkdir -p $JHALFSDIR/extras - cp extras/* $JHALFSDIR/extras - fi - # - if [[ -n "$FILES" ]]; then - # pushd/popd necessary to deal with multiple files - pushd $PACKAGE_DIR 1> /dev/null - cp $FILES $JHALFSDIR/ - popd 1> /dev/null - fi - # - if [[ "${PROGNAME}" = "lfs" ]]; then - if [[ "${CUSTOM_TOOLS}" = "y" ]]; then - echo "Copying custom tool scripts to $JHALFSDIR" - mkdir -p $JHALFSDIR/custom-commands/config - mkdir -p $JHALFSDIR/custom-commands/scripts - cp -Rf custom/* $JHALFSDIR/custom-commands - fi - fi - - # + # Prepare report creation, if needed if [[ "$REPORT" = "y" ]]; then cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/ # After being sure that all looks sane, dump the settings to a file @@ -379,13 +366,23 @@ if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then validate_config > $JHALFSDIR/jhalfs.config fi # - [[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/ + # Copy optimize files, if needed + [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/ # - cp $COMMON_DIR/packages.xsl $JHALFSDIR/ + # Copy compare files, if needed + if [[ "$COMPARE" = "y" ]]; then + mkdir -p $JHALFSDIR/extras + cp extras/* $JHALFSDIR/extras + fi # - sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL} - export XSL=$JHALFSDIR/${XSL} + # Copy custom tools config files, if requested + if [[ "${CUSTOM_TOOLS}" = "y" ]]; then + echo "Copying custom tool scripts to $JHALFSDIR" + mkdir -p $JHALFSDIR/custom-commands + cp -f custom/config/* $JHALFSDIR/custom-commands + fi + # # Install blfs-tool, if requested. if [[ "${BLFS_TOOL}" = "y" ]] ; then # Install the files @@ -405,6 +402,7 @@ if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then cp -r $COMMON_DIR/blfs-tool-deps $JHALFSDIR/ rm -rf $JHALFSDIR/blfs-tool-deps/.svn fi + # get_book echo "${SD_BORDER}${nl_}" @@ -437,11 +435,7 @@ if [[ "$REBUILD_MAKEFILE" = "y" ]] ; then fi build_Makefile -if [[ "${PROGNAME}" = "lfs" ]]; then - if [[ "${CUSTOM_TOOLS}" = "y" ]]; then - add_CustomTools - fi -fi + echo "${SD_BORDER}${nl_}" run_make