On 6/25/06, Dan Nicholson <[EMAIL PROTECTED]> wrote:

I think if you want to be making 8 calls per second, you should try to
limit them to bash built-ins only.  One option would be to touch a
file at the beginning of the target script.

Attached is one solution that is working on my box (so far).  The
whole system is noticeably less sluggish while building.  `top' looks
normal again.

/tmp may not be the best place for the temp file.  I suppose you could
put it in $JHALFSDIR instead.

--
Dan
Index: common/progress_bar.sh
===================================================================
--- common/progress_bar.sh	(revision 2807)
+++ 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 temp file
+[[ -z $1 ]] || [[ -z $2 ]] && exit
 TARGET=$1  # Remember the target build we are looking for
+TARGET_TMPFILE=$2  # Loop while this file exists
 
 declare -r  CSI=$'\e['  # DEC terminology, Control Sequence Introducer
 declare -r  CURSOR_OFF=${CSI}$'?25l'
@@ -24,7 +25,7 @@
 
 write_or_exit() {
     # make has been killed or failed or run to completion, leave
-  if ! fuser -v . 2>&1 | grep make >/dev/null ; then
+  if [[ ! -f ${TARGET_TMPFILE} ]] ; then
      echo -n "${CURSOR_ON}" && exit
   fi
     # Target build complete, leave.
Index: common/common-functions
===================================================================
--- common/common-functions	(revision 2807)
+++ common/common-functions	(working copy)
@@ -201,7 +201,8 @@
 
 $i:  $PREV
 	@\$(call echo_message, Building)
-	@./progress_bar.sh \$@ &
+	@touch /tmp/jhalfs.\$@
+	@./progress_bar.sh \$@ /tmp/jhalfs.\$@ &
 	@echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >logs/$LOGFILE
 EOF
 ) >> $MKFILE.tmp
@@ -483,7 +484,8 @@
 #----------------------------------#
 (
 cat << EOF
-	@touch  \$@ && \\
+	@rm -f /tmp/jhalfs.\$@ && \\
+	touch  \$@ && \\
 	sleep .25 && \\
 	echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
 	echo --------------------------------------------------------------------------------\$(WHITE)
Index: master.sh
===================================================================
--- master.sh	(revision 2807)
+++ master.sh	(working copy)
@@ -7,6 +7,8 @@
 #-----------------------#
 simple_error() {        # Basic error trap.... JUST DIE
 #-----------------------#
+  # Remove anything left behind by jhalfs
+  rm -f /tmp/jhalfs.*
   # If +e then disable text output
   if [[ "$-" =~ "e" ]]; then
     echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
@@ -14,6 +16,8 @@
 }
 
 see_ya() {
+    # Remove anything left behind by jhalfs
+    rm -f /tmp/jhalfs.*
     echo -e "\n\t${BOLD}Goodbye and thank you for choosing ${L_arrow}jhalfs${R_arrow}\n"
 }
 ##### Simple error TRAPS
@@ -30,7 +34,8 @@
 set -e
 trap see_ya 0
 trap simple_error ERR
-trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" &&  exit 2'  1 2 3 15 17 18 23
+trap 'rm -f /tmp/jhalfs.* &&  echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" &&  exit 2' \
+    1 2 3 15 17 18 23
 #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 
 
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to