Using dd option status=progress if available
This commit is contained in:
parent
56238c3c6a
commit
557e69ada1
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2019
|
||||
# Copyright (c) 2019 - 2020
|
||||
# Nio Wiklund alias sudodus <nio dot wiklund at gmail dot com>
|
||||
# Thomas Schmitt <scdbackup@gmx.net>
|
||||
# Provided under GPL version 2 or later.
|
||||
@ -127,6 +127,8 @@ xdt_print_usage() {
|
||||
echo " is found, then they get listed but no writing"
|
||||
echo " happens. In this case, re-run with one of the"
|
||||
echo " advised device names to get a real write run."
|
||||
echo " -no_pacifier Do not use dd options to print progress messages"
|
||||
echo " and to perform synchronized output."
|
||||
echo " -dummy Report the -DO_WRITE actions but do not perform"
|
||||
echo " them."
|
||||
echo " -dummy_force If a single device name is given, do a run of"
|
||||
@ -211,6 +213,7 @@ xdt_reset_job() {
|
||||
xdt_do_write=
|
||||
xdt_dummy_run=
|
||||
xdt_dummy_force=
|
||||
xdt_no_pacifier=
|
||||
xdt_do_plug_test=
|
||||
|
||||
# Status
|
||||
@ -313,6 +316,9 @@ xdt_arg_interpreter() {
|
||||
elif test "X$xdt_i" = "X-DO_WRITE"
|
||||
then
|
||||
xdt_do_write=y
|
||||
elif test "X$xdt_i" = "X-no_pacifier"
|
||||
then
|
||||
xdt_no_pacifier=y
|
||||
elif test "X$xdt_i" = "X-help"
|
||||
then
|
||||
xdt_print_usage
|
||||
@ -331,6 +337,17 @@ xdt_arg_interpreter() {
|
||||
fi
|
||||
done
|
||||
xdt_predict_su_power || return "$?"
|
||||
# Prepare for using dd pacifier if desired and available
|
||||
xdt_dd_bs="bs=1M"
|
||||
if test -n "$xdt_dd_cmd"
|
||||
then
|
||||
if test -z "$xdt_no_pacifier" && \
|
||||
"$xdt_dd_cmd" if=/dev/zero of=/dev/null count=1 \
|
||||
bs=1M status=progress oflag=dsync 2>/dev/null
|
||||
then
|
||||
xdt_dd_bs="bs=1M status=progress oflag=dsync"
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -725,11 +742,11 @@ xdt_write_image() {
|
||||
fi
|
||||
if test -n "$xdt_dummy_run"
|
||||
then
|
||||
echo " $xdt_sudo_cmd $xdt_dd_cmd if='${1}' bs=1M of=/dev/'${2}' ; sync"
|
||||
echo " $xdt_sudo_cmd $xdt_dd_cmd if='${1}' of=/dev/'${2}' $xdt_dd_bs ; sync"
|
||||
else
|
||||
echo "Performing:"
|
||||
echo " $xdt_sudo_cmd $xdt_dd_cmd if='${1}' bs=1M of=/dev/'${2}' ; sync"
|
||||
$xdt_sudo_cmd "$xdt_dd_cmd" if="${1}" bs=1M of=/dev/"${2}"
|
||||
echo " $xdt_sudo_cmd $xdt_dd_cmd if='${1}' of=/dev/'${2}' $xdt_dd_bs ; sync"
|
||||
$xdt_sudo_cmd "$xdt_dd_cmd" if="${1}" of=/dev/"${2}" $xdt_dd_bs
|
||||
xdt_ret="$?"
|
||||
sync
|
||||
if test "$xdt_ret" -ne 0
|
||||
|
@ -9,7 +9,7 @@
|
||||
.\" First parameter, NAME, should be all caps
|
||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
.\" other parameters are allowed: see man(7), man(1)
|
||||
.TH XORRISO-DD-TARGET 1 "Version 1.5.3, Dec 7, 2019"
|
||||
.TH XORRISO-DD-TARGET 1 "Version 1.5.3, Jan 6, 2020"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.\" Some roff macros, for reference:
|
||||
@ -270,7 +270,7 @@ Unmounted: /dev/sde2
|
||||
.br
|
||||
Performing:
|
||||
.br
|
||||
sudo /bin/dd if='debian\-live\-10.0.0\-amd64\-xfce.iso' bs=1M of=/dev/sde ; sync
|
||||
sudo /bin/dd if='debian\-live\-10.0.0\-amd64\-xfce.iso' of=/dev/sde bs=1M status=progress oflag=dsync ; sync
|
||||
.br
|
||||
... dd messages ...
|
||||
.SS
|
||||
@ -326,7 +326,7 @@ AGAINST THE ADVICE BY THIS PROGRAM, a daring user could do:
|
||||
.br
|
||||
sudo /bin/umount /dev/sdd3
|
||||
.br
|
||||
sudo /bin/dd if='debian\-live\-10.0.0\-amd64\-xfce.iso' bs=1M of=/dev/sdd ; sync
|
||||
sudo /bin/dd if='debian\-live\-10.0.0\-amd64\-xfce.iso' of=/dev/sdd bs=1M status=progress oflag=dsync ; sync
|
||||
.br
|
||||
BE SMART. BE CAUTIOUS. BEWARE.
|
||||
.SS
|
||||
@ -494,6 +494,11 @@ In this case, to get a real write run, consider unplugging unneeded devices,
|
||||
or using option \-plug_test, or a re\-run with one of the advised device names
|
||||
as additional argument.
|
||||
.TP
|
||||
\fB\-no_pacifier\fR
|
||||
Do not use dd options to print progress messages and to perform synchronized
|
||||
output. These options are used by default if program dd offers progress
|
||||
messages.
|
||||
.TP
|
||||
\fB\-dummy\fR
|
||||
Report the \-DO_WRITE actions but do not perform them.
|
||||
.TP
|
||||
|
@ -224,8 +224,8 @@ Looking for mount points of sde:
|
||||
Unmounted: /dev/sde1
|
||||
Unmounted: /dev/sde2
|
||||
Performing:
|
||||
sudo /bin/dd if='debian-live-10.0.0-amd64-xfce.iso' bs=1M of=/dev/sde ;
|
||||
sync
|
||||
sudo /bin/dd if='debian-live-10.0.0-amd64-xfce.iso' of=/dev/sde bs=1M
|
||||
status=progress oflag=dsync ; sync
|
||||
... dd messages ...
|
||||
|
||||
|
||||
@ -263,8 +263,8 @@ AGAINST THE ADVICE BY THIS PROGRAM, a daring user could do:
|
||||
sudo /bin/umount /dev/sdd1
|
||||
sudo /bin/umount /dev/sdd2
|
||||
sudo /bin/umount /dev/sdd3
|
||||
sudo /bin/dd if='debian-live-10.0.0-amd64-xfce.iso' bs=1M of=/dev/sdd ;
|
||||
sync
|
||||
sudo /bin/dd if='debian-live-10.0.0-amd64-xfce.iso' of=/dev/sdd bs=1M
|
||||
status=progress oflag=dsync ; sync
|
||||
BE SMART. BE CAUTIOUS. BEWARE.
|
||||
|
||||
|
||||
@ -390,6 +390,10 @@ File: xorriso-dd-target.info, Node: Options, Next: Examples, Prev: Overview,
|
||||
In this case, to get a real write run, consider unplugging unneeded
|
||||
devices, or using option -plug_test, or a re-run with one of the
|
||||
advised device names as additional argument.
|
||||
-no_pacifier
|
||||
Do not use dd options to print progress messages and to perform
|
||||
synchronized output. These options are used by default if program
|
||||
dd offers progress messages.
|
||||
-dummy
|
||||
Report the -DO_WRITE actions but do not perform them.
|
||||
-dummy_force
|
||||
@ -478,15 +482,16 @@ File: xorriso-dd-target.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal
|
||||
* Menu:
|
||||
|
||||
* -DO_WRITE write image file to device: Options. (line 48)
|
||||
* -dummy report but do not perform: Options. (line 55)
|
||||
* -dummy_force show raw copy commands: Options. (line 57)
|
||||
* -help print help text to stdout: Options. (line 61)
|
||||
* -dummy report but do not perform: Options. (line 59)
|
||||
* -dummy_force show raw copy commands: Options. (line 61)
|
||||
* -help print help text to stdout: Options. (line 65)
|
||||
* -image_file set path of disk image file: Options. (line 45)
|
||||
* -list_all print list of disk devices: Options. (line 15)
|
||||
* -list_long print extra device info: Options. (line 18)
|
||||
* -look_for_iso demand presence of ISO 9660: Options. (line 33)
|
||||
* -max_size set size limit for device: Options. (line 24)
|
||||
* -min_size set size limit for device: Options. (line 29)
|
||||
* -no_pacifier do not show dd progress: Options. (line 55)
|
||||
* -plug_test detect target device plugging: Options. (line 7)
|
||||
* -with_sudo run lsblk, umount, dd by sudo: Options. (line 38)
|
||||
* -with_vendor_model add drive info to advice: Options. (line 22)
|
||||
@ -501,6 +506,7 @@ File: xorriso-dd-target.info, Node: ConceptIdx, Next: Top, Prev: CommandIdx,
|
||||
* Menu:
|
||||
|
||||
* Bugs, reporting: Bugreport. (line 6)
|
||||
* dd progress, do not show, -no_pacifier: Options. (line 55)
|
||||
* Device info, print extra, -list_long: Options. (line 18)
|
||||
* Device size, set limit, -max_size: Options. (line 24)
|
||||
* Device size, set limit, -min_size: Options. (line 29)
|
||||
@ -508,12 +514,12 @@ File: xorriso-dd-target.info, Node: ConceptIdx, Next: Top, Prev: CommandIdx,
|
||||
* disk image file, set path, -image_file: Options. (line 45)
|
||||
* disk image file, write to device, -DO_WRITE: Options. (line 48)
|
||||
* Drive info, add to advice, -with_vendor_model: Options. (line 22)
|
||||
* help text, print to stdout, -help: Options. (line 61)
|
||||
* help text, print to stdout, -help: Options. (line 65)
|
||||
* ISO 9660, demand presence on target, -look_for_iso: Options. (line 33)
|
||||
* lsblk, umount, dd, run by sudo, -with_sudo: Options. (line 38)
|
||||
* only report, do not perform, -dummy: Options. (line 55)
|
||||
* only report, do not perform, -dummy: Options. (line 59)
|
||||
* Problems, reporting: Bugreport. (line 6)
|
||||
* raw copy commands, show, -dummy_force: Options. (line 57)
|
||||
* raw copy commands, show, -dummy_force: Options. (line 61)
|
||||
* Reasons, list of: Reasons. (line 6)
|
||||
* Target device, detect by plugging, -plug_test: Options. (line 7)
|
||||
* Use case, detect intended device by plugging: Plugtest. (line 6)
|
||||
@ -535,15 +541,15 @@ Node: Listall3516
|
||||
Node: Givendevices5089
|
||||
Node: Plugtest6053
|
||||
Node: Dowrite7954
|
||||
Node: Unwise9069
|
||||
Node: Reasons10581
|
||||
Node: Options13162
|
||||
Node: Examples15964
|
||||
Node: Files16137
|
||||
Node: Seealso16295
|
||||
Node: Bugreport16461
|
||||
Node: Legal17048
|
||||
Node: CommandIdx17752
|
||||
Node: ConceptIdx18872
|
||||
Node: Unwise9097
|
||||
Node: Reasons10637
|
||||
Node: Options13218
|
||||
Node: Examples16208
|
||||
Node: Files16381
|
||||
Node: Seealso16539
|
||||
Node: Bugreport16705
|
||||
Node: Legal17292
|
||||
Node: CommandIdx17996
|
||||
Node: ConceptIdx19189
|
||||
|
||||
End Tag Table
|
||||
|
@ -50,7 +50,7 @@
|
||||
@c man .\" First parameter, NAME, should be all caps
|
||||
@c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
@c man .\" other parameters are allowed: see man(7), man(1)
|
||||
@c man .TH XORRISO-DD-TARGET 1 "Version 1.5.3, Dec 7, 2019"
|
||||
@c man .TH XORRISO-DD-TARGET 1 "Version 1.5.3, Jan 6, 2020"
|
||||
@c man .\" Please adjust this date whenever revising the manpage.
|
||||
@c man .\"
|
||||
@c man .\" Some roff macros, for reference:
|
||||
@ -375,7 +375,7 @@ Unmounted: /dev/sde2
|
||||
@*
|
||||
Performing:
|
||||
@*
|
||||
sudo /bin/dd if='debian-live-10.0.0-amd64-xfce.iso' bs=1M of=/dev/sde ; sync
|
||||
sudo /bin/dd if='debian-live-10.0.0-amd64-xfce.iso' of=/dev/sde bs=1M status=progress oflag=dsync ; sync
|
||||
@*
|
||||
... dd messages ...
|
||||
@c man .SS
|
||||
@ -434,7 +434,7 @@ AGAINST THE ADVICE BY THIS PROGRAM, a daring user could do:
|
||||
@*
|
||||
sudo /bin/umount /dev/sdd3
|
||||
@*
|
||||
sudo /bin/dd if='debian-live-10.0.0-amd64-xfce.iso' bs=1M of=/dev/sdd ; sync
|
||||
sudo /bin/dd if='debian-live-10.0.0-amd64-xfce.iso' of=/dev/sdd bs=1M status=progress oflag=dsync ; sync
|
||||
@*
|
||||
BE SMART. BE CAUTIOUS. BEWARE.
|
||||
@c man .SS
|
||||
@ -630,6 +630,13 @@ In this case, to get a real write run, consider unplugging unneeded devices,
|
||||
or using option -plug_test, or a re-run with one of the advised device names
|
||||
as additional argument.
|
||||
@c man .TP
|
||||
@item -no_pacifier
|
||||
@kindex -no_pacifier do not show dd progress
|
||||
@cindex dd progress, do not show, -no_pacifier
|
||||
Do not use dd options to print progress messages and to perform synchronized
|
||||
output. These options are used by default if program dd offers progress
|
||||
messages.
|
||||
@c man .TP
|
||||
@item -dummy
|
||||
@kindex -dummy report but do not perform
|
||||
@cindex only report, do not perform, -dummy
|
||||
|
Loading…
Reference in New Issue
Block a user