Here's a patch so that make will pass the PID to progress-bar.sh
rather than trying to find the PID from fuser. I've tested this and it
seems to work well. Further, it seems to be more robust, as sometimes
the progress bar wouldn't show up when using fuser. This makes use of
the $PPID shell variable. Some background here:
http://linuxfromscratch.org/pipermail/alfs-discuss/2006-August/008819.html
--
Dan
Index: BLFS/gen-makefile.sh
===================================================================
--- BLFS/gen-makefile.sh (revision 3105)
+++ BLFS/gen-makefile.sh (working copy)
@@ -26,7 +26,7 @@
$i: $PREV
@\$(call echo_message, Building)
- @./progress_bar.sh \$@ &
+ @./progress_bar.sh \$@ \$\$PPID &
EOF
) >> $MKFILE.tmp
}
Index: common/progress_bar.sh
===================================================================
--- common/progress_bar.sh (revision 3105)
+++ common/progress_bar.sh (working copy)
@@ -4,9 +4,10 @@
set -e
-# Be sure that we know the taget name
-[[ -z $1 ]] && exit
+# Be sure that we know the target name and make PID
+[[ $# == 2 ]] || exit
TARGET=$1 # Remember the target build we are looking for
+makePID=$2 # Monitor the PID of the make process
declare -r CSI=$'\e[' # DEC terminology, Control Sequence Introducer
declare -r CURSOR_OFF=${CSI}$'?25l'
@@ -21,9 +22,6 @@
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
Index: common/common-functions
===================================================================
--- common/common-functions (revision 3105)
+++ common/common-functions (working copy)
@@ -44,7 +44,7 @@
$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 @@
$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 @@
$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 @@
$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
--
http://linuxfromscratch.org/mailman/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page