[Rear-users] SF.net SVN: rear:[801] trunk/usr

jhoekx at users.sourceforge.net jhoekx at users.sourceforge.net
Fri Mar 16 18:37:24 CET 2012


Revision: 801
          http://rear.svn.sourceforge.net/rear/?rev=801&view=rev
Author:   jhoekx
Date:     2012-03-16 17:37:24 +0000 (Fri, 16 Mar 2012)
Log Message:
-----------
Remove progress thread.

The thread was nog longer useful and created an orphan process.
After using "abort" during layout, it was impossible to restart rear without
killing the process.

Modified Paths:
--------------
    trunk/usr/sbin/rear
    trunk/usr/share/rear/backup/NETFS/default/50_make_backup.sh
    trunk/usr/share/rear/backup/RSYNC/default/50_make_rsync_backup.sh
    trunk/usr/share/rear/lib/_input-output-functions.sh
    trunk/usr/share/rear/lib/progresssubsystem.nosh
    trunk/usr/share/rear/restore/NETFS/default/40_restore_backup.sh
    trunk/usr/share/rear/restore/RSYNC/default/40_restore_rsync_backup.sh

Modified: trunk/usr/sbin/rear
===================================================================
--- trunk/usr/sbin/rear	2012-03-16 17:36:07 UTC (rev 800)
+++ trunk/usr/sbin/rear	2012-03-16 17:37:24 UTC (rev 801)
@@ -175,10 +175,6 @@
 
 # enable debug output of the progress pipe
 if [[ "$DEBUG" ]]; then
-	if [[ "$ProgressPID" ]]; then
-		kill -WINCH $ProgressPID
-		BugIfError "Could not kill -PWR ProgressPID"
-	fi
 	KEEP_BUILD_DIR=1
 fi
 

Modified: trunk/usr/share/rear/backup/NETFS/default/50_make_backup.sh
===================================================================
--- trunk/usr/share/rear/backup/NETFS/default/50_make_backup.sh	2012-03-16 17:36:07 UTC (rev 800)
+++ trunk/usr/share/rear/backup/NETFS/default/50_make_backup.sh	2012-03-16 17:37:24 UTC (rev 801)
@@ -72,7 +72,7 @@
 			blocks="$(tail -1 ${TMP_DIR}/${BACKUP_PROG_ARCHIVE}.log | awk 'BEGIN { FS="[ :]" } /^block [0-9]+: / { print $2 }')"
 			size="$((blocks*512))"
 			#echo -en "\e[2K\rArchived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec]"
-			echo "INFO Archived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec]" >&8
+			ProgressInfo "Archived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec]"
 		done
 		;;
 	(rsync)
@@ -85,7 +85,7 @@
 		while sleep 1 ; kill -0 $BackupPID 2>&8; do
 			let disk_used="$(get_disk_used "$backuparchive")" size=disk_used-old_disk_used
 			#echo -en "\e[2K\rArchived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec]"
-			echo "INFO Archived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec]" >&8
+			ProgressInfo "Archived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec]"
 		done
 		;;
 	(*)
@@ -97,7 +97,7 @@
 Killed the backup program and aborting."
 			}
 			#echo -en "\e[2K\rArchived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec]"
-			echo "INFO Archived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec]" >&8
+			ProgressInfo "Archived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec]"
 		done
 		;;
 esac

Modified: trunk/usr/share/rear/backup/RSYNC/default/50_make_rsync_backup.sh
===================================================================
--- trunk/usr/share/rear/backup/RSYNC/default/50_make_rsync_backup.sh	2012-03-16 17:36:07 UTC (rev 800)
+++ trunk/usr/share/rear/backup/RSYNC/default/50_make_rsync_backup.sh	2012-03-16 17:37:24 UTC (rev 801)
@@ -93,12 +93,12 @@
 			;;
 			esac
 
-			echo "INFO Archived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec]" >&8
+			ProgressInfo "Archived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec]"
 		done
 		;;
 
 	(*)
-		echo "INFO Archiving" >&8
+		ProgressInfo "Archiving"
 		while sleep 1 ; kill -0 $BackupPID 2>/dev/null ; do
 			ProgressStep
 		done

Modified: trunk/usr/share/rear/lib/_input-output-functions.sh
===================================================================
--- trunk/usr/share/rear/lib/_input-output-functions.sh	2012-03-16 17:36:07 UTC (rev 800)
+++ trunk/usr/share/rear/lib/_input-output-functions.sh	2012-03-16 17:37:24 UTC (rev 801)
@@ -214,3 +214,7 @@
 ProgressStep() {
 	: ;
 }
+
+ProgressInfo() {
+	: ;
+}
\ No newline at end of file

Modified: trunk/usr/share/rear/lib/progresssubsystem.nosh
===================================================================
--- trunk/usr/share/rear/lib/progresssubsystem.nosh	2012-03-16 17:36:07 UTC (rev 800)
+++ trunk/usr/share/rear/lib/progresssubsystem.nosh	2012-03-16 17:37:24 UTC (rev 801)
@@ -1,70 +1,14 @@
 # call StartProgressSubsystem to get more detailed progress reports
 if tty -s <&1; then
-	######################## BEGIN Progress Indicator
-	# ProgressPipe uses fd 8 as a communication pipe
-
-	# The ProgressThread listens on stdin and writes out progress chars for each line
-	# The signals USR2 and USR1 start and stop the process character printing
-	ProgressThread() {
-		exec 3>&2- # open fd 3 to real stderr
-		debugoutput=0
-		builtin trap "progress_counter=-1" USR1
-		builtin trap "progress_counter=0" USR2
-		builtin trap "debugoutput=1" WINCH
-		progress_counter=-1
-		### A set of spinners coming from Alpine
-#		progress_chars=( '<|>' '</>' '<->' '<\>' )
-#		progress_chars=( '--|-(o)-|--' '--/-(o)-\--' '----(o)----' '--\-(o)-/--' )
-#		progress_chars=( '<|>' '<\>' '<->' '</>' )
-#		progress_chars=( '|  ' ' / ' ' _ ' '  \ ' '  |' '  |' ' \ ' ' _ ' ' / ' '|  ')
-#		progress_chars=( '.' '..' '...' '....' '...' '..' )
-#		progress_chars=( ' . ' ' o ' ' O ' ' o ' )
-#		progress_chars=( '....' ' ...' '. ..' '.. .' '... ' )
-#		progress_chars=( '.   ' ' .  ' '  . ' '   .' '  . ' ' .  ' )
-#		progress_chars=( '.oOo' 'oOo.' 'Oo.o' 'o.oO' )
-#		progress_chars=( '.     .' ' .   . ' '  . .  ' '   .   ' '   +   ' '   *   ' '   X   ' '   #   ' '       ')
-#		progress_chars=( '. O' 'o o' 'O .' 'o o' )
-#		progress_chars=( ' / ' ' _ ' ' \ ' ' | ' ' \ ' ' _ ' )
-#		progress_chars=( '    ' '*   ' '-*  ' '--* ' ' --*' '  --' '   -' )
-#		progress_chars=( '\/\/' '/\/\' )
-#		progress_chars=( '\|/|' '|\|/' '/|\|' '|/|\' )
-		progress_chars=( "\\" '|' '/' '-' )
-		while read command text ; do
-			if [ $debugoutput -eq 1 ] ; then
-				echo "PROGRESS: $command $text" >&3
-			fi
-			if [ "$command" == "START" ] ; then
-				echo -en "\e[2K\r$text  \e7${progress_chars[0]}"
-				progress_counter=0
-			elif [ "$command" == "INFO" ] ; then
-				echo -en "\e[2K\r$text  \e7"
-			fi
-			if [ $progress_counter -gt -1 ] ; then
-				let progress_counter++
-				test $progress_counter -ge ${#progress_chars[@]} && progress_counter=0
-				echo -en "\e8${progress_chars[progress_counter]}"
-
-			fi
-		done
-	}
-
-	exec 8>&- # first close, then open
-	exec 8> >(ProgressThread) # start ProgressPipe listening at fd 8
-	# we need the PID of the process thread to be able to signal it
-	export ProgressPID=$!
-
 	ProgressStart() {
-		echo -en "\e[2K\r$*  \e7"
-		kill -USR2 $ProgressPID
+		echo -en "\e[2K\r$*\e7"
 	}
 
 	ProgressStop() {
-		kill -USR1 $ProgressPID
 		echo -e "\e8\e[KOK"
 	}
 
 	ProgressError() {
-		kill -USR1 $ProgressPID
 		echo -e "\e8\e[KFAILED"
 	}
 
@@ -72,12 +16,12 @@
 		echo noop >&8
 	}
 
+	ProgressInfo() {
+		echo -en "\e[2K\r$*\e7"
+	}
+
 else
 	# no tty, disable progress animated display altogether
-
-	exec 8>&- # first close, then open
-	exec 8>/dev/null # start ProgressPipe listening at fd 8
-
 	ProgressStart() {
 		echo -n "$*  "
 	}
@@ -89,11 +33,6 @@
 	ProgressError() {
 		echo -e "FAILED"
 	}
-
-	ProgressStep() {
-		: ;
-	}
-
 fi
 ####################### END Progress Indicator
 

Modified: trunk/usr/share/rear/restore/NETFS/default/40_restore_backup.sh
===================================================================
--- trunk/usr/share/rear/restore/NETFS/default/40_restore_backup.sh	2012-03-16 17:36:07 UTC (rev 800)
+++ trunk/usr/share/rear/restore/NETFS/default/40_restore_backup.sh	2012-03-16 17:37:24 UTC (rev 801)
@@ -49,11 +49,11 @@
 		while sleep 1 ; kill -0 $BackupPID 2>/dev/null ; do
 			blocks="$(tail -1 "${TMP_DIR}/${BACKUP_PROG_ARCHIVE}-restore.log" | awk 'BEGIN { FS="[ :]" } /^block [0-9]+: / { print $2 }')"
 			size="$((blocks*512))"
-			echo "INFO Restored $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec]" >&8
+			ProgressInfo "Restored $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec]"
 		done
 		;;
 	*)
-		echo "INFO Restoring" >&8
+		ProgressInfo "Restoring..."
 		while sleep 1 ; kill -0 $BackupPID 2>/dev/null ; do
 			ProgressStep
 		done

Modified: trunk/usr/share/rear/restore/RSYNC/default/40_restore_rsync_backup.sh
===================================================================
--- trunk/usr/share/rear/restore/RSYNC/default/40_restore_rsync_backup.sh	2012-03-16 17:36:07 UTC (rev 800)
+++ trunk/usr/share/rear/restore/RSYNC/default/40_restore_rsync_backup.sh	2012-03-16 17:37:24 UTC (rev 801)
@@ -53,13 +53,13 @@
 		while sleep 1 ; kill -0 $BackupPID 2>/dev/null ; do
 			fsize=$(get_size "$(tail -2 "${TMP_DIR}/${BACKUP_PROG_ARCHIVE}-restore.log" | head -n 1)")
 			size=$((size+fsize))
-			echo "INFO Restored $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec]" >&8
+			ProgressInfo "Restored $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec]"
 		done
 		;;
 
 	(*)
 
-		echo "INFO Restoring" >&8
+		ProgressInfo "Restoring"
 		while sleep 1 ; kill -0 $BackupPID 2>/dev/null ; do
 			ProgressStep
 		done

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the rear-users mailing list