ace7b80a5b
Resolves: RHEL-29044 Upstream: Fedora Conflict: None commit a5c17afe7e871f7a2593d04b97e8e77fb434642c Author: Coiby Xu <coxu@redhat.com> Date: Fri Jan 12 20:00:53 2024 +0800 Fix potential-bashisms in monitor_dd_progress As suggested by Carl [1], > /usr/lib/dracut/modules.d/99kdumpbase/monitor_dd_progress has some > inconsistencies with other scripts in that directory. It is missing the > .sh extension and is not executable. The latter is resulting in an > rpmlint error. [1] https://bugzilla.redhat.com/show_bug.cgi?id=2239566#c2 Suggested-by: Carl George <carl@redhat.com> Signed-off-by: Coiby Xu <coxu@redhat.com> Reviewed-by: Philipp Rudo <prudo@redhat.com> Reviewed-by: Dave Young <dyoung@redhat.com> Signed-off-by: Lichen Liu <lichliu@redhat.com>
29 lines
482 B
Bash
29 lines
482 B
Bash
#!/bin/sh
|
|
|
|
SRC_FILE_MB=$1
|
|
|
|
while true
|
|
do
|
|
DD_PID=`pidof dd`
|
|
if [ -n "$DD_PID" ]; then
|
|
break
|
|
fi
|
|
done
|
|
|
|
while true
|
|
do
|
|
sleep 5
|
|
if [ ! -d /proc/$DD_PID ]; then
|
|
break
|
|
fi
|
|
|
|
kill -s USR1 $DD_PID
|
|
CURRENT_SIZE=`tail -n 1 /tmp/dd_progress_file | sed "s/[^0-9].*//g"`
|
|
[ -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
|