diff --git a/CLFS/master.sh b/CLFS/master.sh index 10b4fc0..9e3eb74 100755 --- a/CLFS/master.sh +++ b/CLFS/master.sh @@ -6,7 +6,6 @@ ################################### - #----------------------------# host_prep_Makefiles() { # Initialization of the system #----------------------------# @@ -1009,11 +1008,29 @@ build_Makefile() { # Construct a Makefile from the book scripts cat << EOF $HEADER -SRC= /sources -MOUNT_PT= $BUILDDIR -PKG_LST= $PKG_LST -LUSER= $LUSER -LGROUP= $LGROUP +SRC = /sources +MOUNT_PT = $BUILDDIR +PKG_LST = $PKG_LST +LUSER = $LUSER +LGROUP = $LGROUP +SCRIPT_ROOT = $SCRIPT_ROOT + +BASEDIR = \$(MOUNT_PT) +SRCSDIR = \$(BASEDIR)/sources +CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands +LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/logs +TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/test-logs + +crSRCSDIR = /sources +crCMDSDIR = /\$(SCRIPT_ROOT)/$PROGNAME-commands +crLOGDIR = /\$(SCRIPT_ROOT)/logs +crTESTLOGDIR = /\$(SCRIPT_ROOT)/test-logs + +SU_LUSER = su - \$(LUSER) -c +LUSER_HOME = /home/\$(LUSER) +PRT_DU = echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n" +PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) \$(MOUNT_PT)\`\n" + include makefile-functions diff --git a/CLFS2/master.sh b/CLFS2/master.sh index 1d5e0cb..a030015 100755 --- a/CLFS2/master.sh +++ b/CLFS2/master.sh @@ -283,6 +283,7 @@ bootscripts_Makefiles() { # case $this_script in *udev) continue ;; # This is not a script but a commentary, we want udev-rules *console*) continue ;; # Use the files that came with the bootscripts + *network*) continue ;; # Manually create these files *) ;; esac @@ -432,11 +433,22 @@ build_Makefile() { # Construct a Makefile from the book scripts cat << EOF $HEADER -SRC= /sources -MOUNT_PT= $BUILDDIR -PKG_LST= $PKG_LST -LUSER= $LUSER -LGROUP= $LGROUP +SRC = /sources +MOUNT_PT = $BUILDDIR +PKG_LST = $PKG_LST +LUSER = $LUSER +LGROUP = $LGROUP +SCRIPT_ROOT = $SCRIPT_ROOT + +BASEDIR = \$(MOUNT_PT) +SRCSDIR = \$(BASEDIR)/sources +CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands +LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/logs +TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/test-logs + +SU_LUSER = su - \$(LUSER) -c +PRT_DU = echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n" +LUSER_HOME = /home/\$(LUSER) include makefile-functions diff --git a/HLFS/master.sh b/HLFS/master.sh index 69db4b7..5de9243 100755 --- a/HLFS/master.sh +++ b/HLFS/master.sh @@ -13,15 +13,22 @@ process_toolchain() { # embryo,cocoon and butterfly need special handling local toolchain=$1 local this_script=$2 local tc_phase - + local binutil_tarball + local gcc_core_tarball + echo "${tab_}${tab_}${GREEN}toolchain ${L_arrow}${toolchain}${R_arrow}" # # Safe method to remove existing toolchain dirs - pkg_tarball=$(get_package_tarball_name "binutils") - wrt_remove_existing_dirs "$pkg_tarball" - pkg_tarball=$(get_package_tarball_name "gcc-core") - wrt_remove_existing_dirs "$pkg_tarball" + binutil_tarball=$(get_package_tarball_name "binutils") + gcc_core_tarball=$(get_package_tarball_name "gcc-core") +( +cat << EOF + @\$(call remove_existing_dirs,$binutil_tarball) + @\$(call remove_existing_dirs,$gcc_core_tarball) +EOF +) >> $MKFILE.tmp + # # Manually remove the toolchain directories.. tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'` @@ -54,10 +61,17 @@ EOF esac # # Safe method to remove packages unpacked while inside the toolchain script - pkg_tarball=$(get_package_tarball_name "binutils") - wrt_remove_existing_dirs "$pkg_tarball" - pkg_tarball=$(get_package_tarball_name "gcc-core") - wrt_remove_existing_dirs "$pkg_tarball" +# pkg_tarball=$(get_package_tarball_name "binutils") +# wrt_remove_existing_dirs "$pkg_tarball" +# pkg_tarball=$(get_package_tarball_name "gcc-core") +# wrt_remove_existing_dirs "$pkg_tarball" +( +cat << EOF + @\$(call remove_existing_dirs,$binutil_tarball) + @\$(call remove_existing_dirs,$gcc_core_tarball) +EOF +) >> $MKFILE.tmp + # # Manually remove the toolchain directories.. tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'` @@ -482,11 +496,28 @@ build_Makefile() { # Construct a Makefile from the book scripts cat << EOF $HEADER -SRC= /sources -MOUNT_PT= $BUILDDIR -PKG_LST= $PKG_LST -LUSER= $LUSER -LGROUP= $LGROUP +SRC = /sources +MOUNT_PT = $BUILDDIR +PKG_LST = $PKG_LST +LUSER = $LUSER +LGROUP = $LGROUP +SCRIPT_ROOT = $SCRIPT_ROOT + +BASEDIR = \$(MOUNT_PT) +SRCSDIR = \$(BASEDIR)/sources +CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands +LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/logs +TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/test-logs + +crSRCSDIR = /sources +crCMDSDIR = /\$(SCRIPT_ROOT)/$PROGNAME-commands +crLOGDIR = /\$(SCRIPT_ROOT)/logs +crTESTLOGDIR = /\$(SCRIPT_ROOT)/test-logs + +SU_LUSER = su - \$(LUSER) -c +LUSER_HOME = /home/\$(LUSER) +PRT_DU = echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n" +PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) \$(MOUNT_PT)\`\n" include makefile-functions diff --git a/LFS/master.sh b/LFS/master.sh index 46721ba..6968c86 100755 --- a/LFS/master.sh +++ b/LFS/master.sh @@ -7,7 +7,6 @@ ################################### - #----------------------------# chapter4_Makefiles() { #----------------------------# @@ -362,11 +361,29 @@ build_Makefile() { cat << EOF $HEADER -SRC= /sources -MOUNT_PT= $BUILDDIR -PKG_LST= $PKG_LST -LUSER= $LUSER -LGROUP= $LGROUP +SRC = /sources +MOUNT_PT = $BUILDDIR +PKG_LST = $PKG_LST +LUSER = $LUSER +LGROUP = $LGROUP +SCRIPT_ROOT = $SCRIPT_ROOT + +BASEDIR = \$(MOUNT_PT) +SRCSDIR = \$(BASEDIR)/sources +CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands +LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/logs +TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/test-logs + +crSRCSDIR = /sources +crCMDSDIR = /\$(SCRIPT_ROOT)/$PROGNAME-commands +crLOGDIR = /\$(SCRIPT_ROOT)/logs +crTESTLOGDIR = /\$(SCRIPT_ROOT)/test-logs + +SU_LUSER = su - \$(LUSER) -c +LUSER_HOME = /home/\$(LUSER) +PRT_DU = echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n" +PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) \$(MOUNT_PT)\`\n" + include makefile-functions diff --git a/common/common-functions b/common/common-functions index c26c5b8..ffc74c8 100644 --- a/common/common-functions +++ b/common/common-functions @@ -260,98 +260,6 @@ get_package_tarball_name() { # } -#----------------------------------# -wrt_remove_existing_dirs() { # -#----------------------------------# - local PKG_NAME=$1 -( -cat << EOF - @PKG_PATH=\`ls -t \$(MOUNT_PT)\$(SRC)/${PKG_NAME} | head -n1\` && \\ - ROOT=\`tar -tf \$\$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'\` && \\ - [[ -n \$\$ROOT ]] && \\ - rm -rf \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\ - if [ -e \$(MOUNT_PT)\$(SRC)/${PKG_NAME%-*}-build ]; then \\ - rm -rf \$(MOUNT_PT)\$(SRC)/${PKG_NAME%-*}-build; \\ - fi; -EOF -) >> $MKFILE.tmp -} - -#----------------------------------# -wrt_remove_existing_dirs2() { # -#----------------------------------# - local PKG_NAME=$1 -( -cat << EOF - @PKG_PATH=\`ls -t \$(SRC)/${PKG_NAME} | head -n1\` && \\ - ROOT=\`tar -tf \$\$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'\` && \\ - [[ -n \$\$ROOT ]] && \\ - rm -rf \$(SRC)/\$\$ROOT && \\ - if [ -e \$(SRC)/${PKG_NAME%-*}-build ]; then \\ - rm -rf \$(SRC)/${PKG_NAME%-*}-build; \\ - fi; -EOF -) >> $MKFILE.tmp -} - - - -#----------------------------------# -wrt_unpack() { # Unpack and set 'ROOT' var -#----------------------------------# - local FILE=$1 - local optSAVE_PREVIOUS=$2 - - if [ "${optSAVE_PREVIOUS}" != "1" ]; then - wrt_remove_existing_dirs "$FILE" - fi -( -cat << EOF - @\$(call unpack,$FILE) - @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\ - echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\ - chown -R \$(LUSER) \$(MOUNT_PT)\$(SRC)/\$\$ROOT -EOF -) >> $MKFILE.tmp -} - - -#----------------------------------# -wrt_unpack2() { # -#----------------------------------# - local FILE=$1 - local optSAVE_PREVIOUS=$2 - - if [ "${optSAVE_PREVIOUS}" != "1" ]; then - wrt_remove_existing_dirs "$FILE" - fi -( -cat << EOF - @\$(call unpack2,$FILE) - @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\ - echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars -EOF -) >> $MKFILE.tmp -} - - -#----------------------------------# -wrt_unpack3() { # -#----------------------------------# - local FILE=$1 - local optSAVE_PREVIOUS=$2 - - if [ "${optSAVE_PREVIOUS}" != "1" ]; then - wrt_remove_existing_dirs2 "$FILE" - fi -( -cat << EOF - @\$(call unpack3,$FILE) - @ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\ - echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars -EOF -) >> $MKFILE.tmp -} #----------------------------------# wrt_test_log() { # Initialize testsuite log file @@ -390,15 +298,162 @@ EOF } +#----------------------------------# +wrt_copy_fstab() { # +#----------------------------------# + local i=$1 +( + cat << EOF + @cp -v $FSTAB \$(MOUNT_PT)/etc/fstab >>logs/$i 2>&1 +EOF +) >> $MKFILE.tmp +} + + +#----------------------------------# +wrt_copy_fstab2() { # +#----------------------------------# + local i=$1 +( + cat << EOF + @cp -v /sources/fstab /etc/fstab >>logs/$i 2>&1 +EOF +) >> $MKFILE.tmp +} + + +#----------------------------------# +wrt_report() { # +#----------------------------------# +( +cat << EOF + +create-sbu_du-report: $PREV + @\$(call echo_message, Building) + @./create-sbu_du-report.sh logs $VERSION + @\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report) + @touch \$@ +EOF +) >> $MKFILE.tmp + +chapter789="$chapter789 create-sbu_du-report" +} + +unset wrt_unpack +#----------------------------------# +wrt_unpack() { # Unpack and set 'ROOT' var +#----------------------------------# + local FILE=$1 + local optSAVE_PREVIOUS=$2 + + if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then +( +cat << EOF + @\$(call remove_existing_dirs,$FILE) +EOF +) >> $MKFILE.tmp + fi + +( +cat << EOF + @\$(call unpack,$FILE) + @\$(call get_pkg_root) +EOF +) >> $MKFILE.tmp + +} + +unset wrt_unpack2 +#----------------------------------# +wrt_unpack2() { # +#----------------------------------# + local FILE=$1 + local optSAVE_PREVIOUS=$2 + + if [ "${optSAVE_PREVIOUS}" != "1" ]; then +( +cat << EOF + @\$(call remove_existing_dirs,$FILE) +EOF +) >> $MKFILE.tmp + fi +( +cat << EOF + @\$(call unpack2,$FILE) + @\$(call get_pkg_root,nouser) +EOF +) >> $MKFILE.tmp +} + +#----------------------------------# +wrt_unpack3() { # +#----------------------------------# + local FILE=$1 + local optSAVE_PREVIOUS=$2 + + if [ "${optSAVE_PREVIOUS}" != "1" ]; then +( +cat << EOF + @\$(call remove_existing_dirs2,$FILE) +EOF +) >> $MKFILE.tmp + fi +( +cat << EOF + @\$(call unpack3,$FILE) + @\$(call get_pkg_root2) +EOF +) >> $MKFILE.tmp +} + + +unset wrt_remove_build_dirs +#----------------------------------# +wrt_remove_build_dirs() { # +#----------------------------------# + local name=$1 +( +cat << EOF + @\$(call remove_build_dirs,$name) +EOF +) >> $MKFILE.tmp +} + +#----------------------------------# +wrt_remove_build_dirs2() { # +#----------------------------------# + local name=$1 +( +cat << EOF + @\$(call remove_build_dirs2,$name) +EOF +) >> $MKFILE.tmp +} + + + +unset wrt_touch +#----------------------------------# +wrt_touch() { # +#----------------------------------# +( +cat << EOF + @\$(call housekeeping) +EOF +) >> $MKFILE.tmp +} + +unset wrt_RunAsUser #----------------------------------# wrt_RunAsUser() { # Execute script inside time { }, footer to log file #----------------------------------# local this_script=$1 local file=$2 + ( cat << EOF - @( time { su - \$(LUSER) -c "source /home/\$(LUSER)/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\ - echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script + @( time { \$(SU_LUSER) "source \$(LUSER_HOME)/.bashrc && \$(CMDSDIR)/`dirname $file`/\$@" >> logs/\$@ 2>&1; } ) 2>> logs/\$@ && \\ + \$(PRT_DU) >> logs/\$@ EOF ) >> $MKFILE.tmp } @@ -422,13 +477,12 @@ wrt_RunAsRoot() { # Some scripts must be run as root.. ( cat << EOF - @( time { export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\ - echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script + @( time { export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@ && \\ + \$(PRT_DU_CR) >>logs/\$@ EOF ) >> $MKFILE.tmp } - #----------------------------------# wrt_run_as_root2() { # #----------------------------------# @@ -436,27 +490,28 @@ wrt_run_as_root2() { # local file=$2 ( cat << EOF - @( time { source envars && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\ - echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \`\n" >>logs/$this_script + @( time { source envars && ${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@ && \\ + echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \`\n" >>logs/\$@ EOF ) >> $MKFILE.tmp } +unset wrt_run_as_chroot1 #----------------------------------# wrt_run_as_chroot1() { # #----------------------------------# local this_script=$1 local file=$2 ( - cat << EOF - @( time { \$(CHROOT1) 'cd /${SCRIPT_ROOT} && source envars && /${SCRIPT_ROOT}/${PROGNAME}-commands/$file >>/${SCRIPT_ROOT}/logs/${this_script} 2>&1' ; } ) 2>>logs/$this_script && \\ - echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/${this_script} +cat << EOF + @( time { \$(CHROOT1) 'cd \$(SCRIPT_ROOT) && source envars && \$(crCMDSDIR)/`dirname $file`/\$@ >>logs/\$@ 2>&1' ; } ) 2>>logs/\$@ && \\ + \$(PRT_DU_CR) >> logs/\$@ EOF ) >> $MKFILE.tmp } - +unset wrt_run_as_chroot2 #----------------------------------# wrt_run_as_chroot2() { # #----------------------------------# @@ -464,99 +519,54 @@ wrt_run_as_chroot2() { # local file=$2 ( cat << EOF - @( time { \$(CHROOT2) 'cd /${SCRIPT_ROOT} && source envars && /${SCRIPT_ROOT}/${PROGNAME}-commands/$file >>/${SCRIPT_ROOT}/logs/${this_script} 2>&1' ; } ) 2>>logs/$this_script && \\ - echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/${this_script} + @( time { \$(CHROOT2) 'cd \$(SCRIPT_ROOT) && source envars && \$(crCMDSDIR)/`dirname $file`/\$@ >>logs/\@ 2>&1' ; } ) 2>>logs/\@ && \\ + \$(PRT_DU_CR) >> logs/\$@ EOF ) >> $MKFILE.tmp } - +unset wrt_target #----------------------------------# -wrt_copy_fstab() { # +wrt_target() { # Create target and initialize log file #----------------------------------# local i=$1 -( - cat << EOF - @cp -v $FSTAB \$(MOUNT_PT)/etc/fstab >>logs/$i 2>&1 -EOF -) >> $MKFILE.tmp -} - -#----------------------------------# -wrt_copy_fstab2() { # -#----------------------------------# - local i=$1 -( - cat << EOF - @cp -v /sources/fstab /etc/fstab >>logs/$i 2>&1 -EOF -) >> $MKFILE.tmp -} - - -#----------------------------------# -wrt_remove_build_dirs() { # -#----------------------------------# - local name=$1 -( -cat << EOF - @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\ - rm -rf \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\ - if [ -e \$(MOUNT_PT)\$(SRC)/$name-build ]; then \\ - rm -rf \$(MOUNT_PT)\$(SRC)/$name-build; \\ - fi; -EOF -) >> $MKFILE.tmp -} - - -#----------------------------------# -wrt_remove_build_dirs2() { # -#----------------------------------# - local name=$1 -( -cat << EOF - @ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\ - rm -rf \$(SRC)/\$\$ROOT && \\ - if [ -e \$(SRC)/$name-build ]; then \\ - rm -rf \$(SRC)/$name-build; \\ - fi; -EOF -) >> $MKFILE.tmp -} - - -#----------------------------------# -wrt_touch() { # -#----------------------------------# -( -cat << EOF - @touch \$@ && \\ - sleep .25 && \\ - echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) -EOF -) >> $MKFILE.tmp -} - - -#----------------------------------# -wrt_report() { # -#----------------------------------# + local PREV=$2 + case $i in + iteration* ) local LOGFILE="\$@.log" ;; + * ) local LOGFILE="\$@" ;; + esac ( cat << EOF -create-sbu_du-report: $PREV +$i: $PREV @\$(call echo_message, Building) - @./create-sbu_du-report.sh logs $VERSION - @\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report) - @touch \$@ + @./progress_bar.sh \$@ & + @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >logs/$LOGFILE EOF ) >> $MKFILE.tmp - -chapter789="$chapter789 create-sbu_du-report" } +#----------------------------------# +wrt_target_boot() { # Create target and initialize log file +#----------------------------------# + local i=$1 + local PREV=$2 + case $i in + iteration* ) local LOGFILE="\$@.log" ;; + * ) local LOGFILE="\$@" ;; + esac +( +cat << EOF + +$i: $PREV + @\$(call echo_message, Building) + @./progress_bar.sh \$@ & + @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT}\`\n" >logs/$LOGFILE +EOF +) >> $MKFILE.tmp +} + + #----------------------------# run_make() { # diff --git a/common/makefile-functions b/common/makefile-functions index 6649e1b..93fd3b5 100644 --- a/common/makefile-functions +++ b/common/makefile-functions @@ -15,13 +15,62 @@ define echo_message @echo $(WHITE) endef +define remove_existing_dirs + @PKG_PATH=`ls -t $(SRCSDIR)/$(1) | head -n1` && \ + ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \ + rm -rf $(SRCSDIR)/$$ROOT && \ + rm -rf $(SRCSDIR)/$${ROOT%-*}-build +endef + +define remove_existing_dirs2 + @PKG_PATH=\`ls -t $(SRC)/$(1) | head -n1\` && \ + ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \ + rm -rf $(SRC)/$$ROOT && \ + rm -rf $(SRC)/$${ROOT-*}-build +endef + +define remove_build_dirs + @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \ + rm -rf $(SRCSDIR)/$$ROOT && \ + rm -rf $(SRCSDIR)/$(1)-build +endef + +define remove_build_dirs2 + @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \ + rm -rf $(SRC)/$$ROOT && \ + rm -rf $(SRC)/$(1)-build +endef + +define housekeeping + @touch $@ && \ + sleep .25 && \ + echo -e "\n\n "$(BOLD)Target $(BLUE)$@ $(BOLD)OK && \ + echo --------------------------------------------------------------------------------$(WHITE) + +endef + +define get_pkg_root + @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \ + if [ "$(1)" != "nouser" ]; then \ + echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars; \ + chown -R $(LUSER) $(SRCSDIR)/$$ROOT; \ + else \ + echo "export PKGDIR=$(crSRCSDIR)/$$ROOT" > envars; \ + fi; +endef + +define get_pkg_root2 + @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \ + echo "export PKGDIR=$(SRC)/$$ROOT" > envars +endef + define unpack - @cd $(MOUNT_PT)$(SRC) && \ + @cd $(SRCSDIR) && \ tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST) endef define unpack2 - @cd $(MOUNT_PT)$(SRC) && \ + @cd $(SRCSDIR) && \ /tools/bin/tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST) endef diff --git a/master.sh b/master.sh index 4fe98a7..6b09cda 100755 --- a/master.sh +++ b/master.sh @@ -69,8 +69,10 @@ source $MODULE [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}" if [[ -e using_menuconfig ]]; then + [[ $VERBOSITY > 0 ]] && echo -n "Loading config params from ..." source configuration - + [[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1 + [[ $VERBOSITY > 0 ]] && echo "OK" #--- Working directories SCRIPT_ROOT=jhalfs @@ -83,32 +85,33 @@ if [[ -e using_menuconfig ]]; then #--- farce report log directory FARCELOGDIR=$LOGDIR/farce - [[ ! -z ${BRANCH_ID} ]] && - case $BRANCH_ID in - dev* | SVN | trunk ) - case $PROGNAME in - clfs2 ) TREE=branches/clfs-2.0/BOOK ;; - *) TREE=trunk/BOOK ;; + if [[ ! -z ${BRANCH_ID} ]]; then + case $BRANCH_ID in + dev* | SVN | trunk ) + case $PROGNAME in + clfs2 ) TREE=branches/clfs-2.0/BOOK ;; + *) TREE=trunk/BOOK ;; + esac + LFSVRS=development + ;; + branch-* ) + LFSVRS=${BRANCH_ID} + TREE=branches/${BRANCH_ID#branch-}/BOOK + ;; + * ) + case $PROGNAME in + lfs | hlfs ) + LFSVRS=${BRANCH_ID} + TREE=tags/${BRANCH_ID}/BOOK + ;; + clfs | clfs2 ) + LFSVRS=${BRANCH_ID} + TREE=tags/${BRANCH_ID} + ;; + esac + ;; esac - LFSVRS=development - ;; - branch-* ) - LFSVRS=${BRANCH_ID} - TREE=branches/${BRANCH_ID#branch-}/BOOK - ;; - * ) - case $PROGNAME in - lfs | hlfs ) - LFSVRS=${BRANCH_ID} - TREE=tags/${BRANCH_ID}/BOOK - ;; - clfs | clfs2 ) - LFSVRS=${BRANCH_ID} - TREE=tags/${BRANCH_ID} - ;; - esac - ;; - esac + fi fi #===========================================================