[kexec-tools/f19] monitor-dd-progress fix
Baoquan He
baoquan at fedoraproject.org
Tue Jun 25 09:09:29 UTC 2013
commit 306d841252a88bcf4bae3448a835f0b196d164d8
Author: Dave Young <dyoung at redhat.com>
Date: Tue Jun 25 16:15:45 2013 +0800
monitor-dd-progress fix
stdout if line buffered, thus even it's redirect to stderr, it will not show
on console automaticly. Because monitor_dd_progress is only for rawdump
currently, so I think we can just use "echo" instead of "echo -n".
Another problem is sometimes CURRENT_SIZE does not get value when it's used
in $(($CURRENT_SIZE / 1048576)), fix this issue as well.
Signed-off-by: Dave Young <dyoung at redhat.com>
Acked-by: WANG Chao <chaowang at redhat.com>
dracut-monitor_dd_progress | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/dracut-monitor_dd_progress b/dracut-monitor_dd_progress
index 01a1567..e139d33 100644
--- a/dracut-monitor_dd_progress
+++ b/dracut-monitor_dd_progress
@@ -19,8 +19,10 @@ do
kill -s USR1 $DD_PID
CURRENT_SIZE=`tail -n 1 /tmp/dd_progress_file | sed "s/[^0-9].*//g"`
- CURRENT_MB=$(($CURRENT_SIZE / 1048576))
- echo -n -e "Copied $CURRENT_MB MB / $SRC_FILE_MB MB\r"
+ [ -n "$CURRENT_SIZE" ] && {
+ CURRENT_MB=$(($CURRENT_SIZE / 1048576))
+ echo -e "Copied $CURRENT_MB MB / $SRC_FILE_MB MB\r"
+ }
done
rm -f /tmp/dd_progress_file
More information about the scm-commits
mailing list