diff --git a/BLFS/gen-makefile.sh b/BLFS/gen-makefile.sh index 5f96cd5..9f0685e 100755 --- a/BLFS/gen-makefile.sh +++ b/BLFS/gen-makefile.sh @@ -26,7 +26,7 @@ cat << EOF $i: $PREV @\$(call echo_message, Building) - @./progress_bar.sh \$@ & + @./progress_bar.sh \$@ \$\$PPID & EOF ) >> $MKFILE.tmp } diff --git a/common/common-functions b/common/common-functions index b00374e..c89b277 100644 --- a/common/common-functions +++ b/common/common-functions @@ -44,7 +44,7 @@ cat << EOF $i: $PREV @\$(call echo_message, Building) - @./progress_bar.sh \$@ & + @./progress_bar.sh \$@ \$\$PPID & @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >logs/$LOGFILE EOF ) >> $MKFILE.tmp @@ -65,7 +65,7 @@ cat << EOF $i: $PREV @\$(call echo_message, Building) - @./progress_bar.sh \$@ & + @./progress_bar.sh \$@ \$\$PPID & @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT}\`\n" >logs/$LOGFILE EOF ) >> $MKFILE.tmp @@ -367,7 +367,7 @@ cat << EOF $i: $PREV @\$(call echo_message, Building) - @./progress_bar.sh \$@ & + @./progress_bar.sh \$@ \$\$PPID & @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >logs/$LOGFILE EOF ) >> $MKFILE.tmp @@ -387,7 +387,7 @@ cat << EOF $i: $PREV @\$(call echo_message, Building) - @./progress_bar.sh \$@ & + @./progress_bar.sh \$@ \$\$PPID & @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT}\`\n" >logs/$LOGFILE EOF ) >> $MKFILE.tmp diff --git a/common/progress_bar.sh b/common/progress_bar.sh index fb0dc00..35965fa 100755 --- a/common/progress_bar.sh +++ b/common/progress_bar.sh @@ -7,6 +7,7 @@ set -e # Be sure that we know the taget name [[ -z $1 ]] && exit TARGET=$1 # Remember the target build we are looking for +MAKE_PPID=$2 declare -r CSI=$'\e[' # DEC terminology, Control Sequence Introducer declare -r CURSOR_OFF=${CSI}$'?25l' @@ -21,12 +22,9 @@ declare -a GRAPHIC_STR="| / - \\ + " declare -i SEC=0 # Seconds accumulator declare -i PREV_SEC=0 -makePID=$(fuser -v . 2>&1 | grep make) -makePID=$(echo $makePID | cut -d" " -f2) - write_or_exit() { # make has been killed or failed or run to completion, leave - [[ ! -e /proc/$makePID ]] && echo -n "${CURSOR_ON}" && exit + [[ ! -e /proc/${MAKE_PPID} ]] && echo -n "${CURSOR_ON}" && exit # Target build complete, leave. [[ -f ${TARGET} ]] && echo -n "${CURSOR_ON}" && exit