Made changes to -plug_test step 3

This commit is contained in:
Thomas Schmitt 2019-12-02 19:56:08 +01:00
parent 9b711f20ec
commit 74f05d33f5
4 changed files with 68 additions and 46 deletions

View File

@ -252,13 +252,15 @@ plug_in_watcher() {
echo >&2 echo >&2
echo "Step 1:" >&2 echo "Step 1:" >&2
echo "Please make sure that the desired target device is plugged _out_ now." >&2 echo "Please make sure that the desired target device is plugged _out_ now." >&2
echo "If it is currently plugged in, make sure to unmount all its fileystems" >&2
echo "and then unplug it." >&2
echo "Press the Enter key when ready." >&2 echo "Press the Enter key when ready." >&2
read dummy read dummy
old_device_list=' '$($lsblk_cmd -d -n -o NAME | grep -v '^sr[0-9]' | grep -v '^fd[0-9]' | tr '\n\r' ' ')' ' old_device_list=' '$($lsblk_cmd -d -n -o NAME | grep -v '^sr[0-9]' | grep -v '^fd[0-9]' | tr '\n\r' ' ')' '
# <<< Mock-up to save USB socket wear-off by erasing items from old_device_list # <<< Mock-up to save USB socket wear-off by erasing items from old_device_list
# <<< Their presence in new_device_list will let them appear as fresh plugs # <<< Their presence in new_device_list will let them appear as fresh plugs
# old_device_list=' '$(echo -n $old_device_list | sed -e 's/sd[e-f]//')' ' # old_device_list=' '$(echo -n $old_device_list | sed -e 's/sde//')' '
echo "Found and noted as _not_ desired: $old_device_list" >&2 echo "Found and noted as _not_ desired: $old_device_list" >&2
echo >&2 echo >&2
@ -653,11 +655,18 @@ then
echo "Step 3:" >&2 echo "Step 3:" >&2
if test -n "$dummy_run" if test -n "$dummy_run"
then then
echo "This would be the last chance to abort. Press Enter to see -dummy report." >&2 echo "This would be the last chance to abort. Enter the word 'yes' to see -dummy report." >&2
else else
echo "Last chance to abort. Press Enter to start REAL WRITING." >&2 echo "Last chance to abort. Enter the word 'yes' to start REAL WRITING." >&2
fi fi
read dummy read dummy
if test "$dummy" = "yes" -o "$dummy" = "'yes'" -o "$dummy" = '"yes"'
then
dummy=dummy
else
echo "WRITE RUN PREVENTED by user input '$dummy'." >&2
exit 12
fi
fi fi
write_image "$image_file" $candidates write_image "$image_file" $candidates
exit $? exit $?

View File

@ -48,10 +48,10 @@ If a single plausible candidate is detected, then the program is willing to
copy a disk image file onto it. This will overwrite or make inaccessible the copy a disk image file onto it. This will overwrite or make inaccessible the
previous partition table and all previous data content of the target device. previous partition table and all previous data content of the target device.
.br .br
\fBSuperuser power\fR is needed for filesystem type identification, for \fBSuperuser power\fR is normally needed for filesystem type identification,
possible unmounting, and for possible image writing. Option \fB\-with_sudo\fR for possible unmounting, and for possible image writing.
offers a way to gain this power only for those tasks and to run the program Option \fB\-with_sudo\fR offers a way to gain this power only for those
elsewise with a normal user's power. tasks and to run the program elsewise with a normal user's power.
.br .br
If a particular disk image file is intended as copy source, then If a particular disk image file is intended as copy source, then
its path should be given by option \-image_file, so that its size can be used its path should be given by option \-image_file, so that its size can be used
@ -110,7 +110,7 @@ storage, and \- if tested \- of sufficient or plausible size.
\fBreasoning\fR is a blank separated list of words with either suffix '+' \fBreasoning\fR is a blank separated list of words with either suffix '+'
for an inviting device property or '\-' for a prohibitive property. Normally for an inviting device property or '\-' for a prohibitive property. Normally
a single '\-' reason disqualifies the device from being advisable. Only if a single '\-' reason disqualifies the device from being advisable. Only if
option \-look_for_iso is given, a reason "has_...\-" can be overridden by option \-look_for_iso is given, a reason "has_XYZ\-" can be overridden by
the presence of an ISO 9660 filesystem on the device. the presence of an ISO 9660 filesystem on the device.
.br .br
\fBinfo\fR is composed from VENDOR and MODEL as told by lsblk. \fBinfo\fR is composed from VENDOR and MODEL as told by lsblk.
@ -174,7 +174,7 @@ device name was given. Option \-list_all and any device names given as arguments
will be ignored. will be ignored.
.br .br
\fBStep 3\fR happens only if options \-DO_WRITE or \-dummy_force are given. \fBStep 3\fR happens only if options \-DO_WRITE or \-dummy_force are given.
The program asks for a final press of the Enter key before real or simulated The program asks for a final input of the word 'yes' before real or simulated
writing begins. writing begins.
.br .br
Example: Example:
@ -189,6 +189,11 @@ by watching it appear after being plugged in.
Step 1: Step 1:
.br .br
Please make sure that the desired target device is plugged _out_ now. Please make sure that the desired target device is plugged _out_ now.
.br
If it is currently plugged in, make sure to unmount all its fileystems
.br
and then unplug it.
.br
Press the Enter key when ready. Press the Enter key when ready.
.br .br
@ -233,9 +238,9 @@ sde : YES : usb+ has_iso9660+ has_vfat+
.br .br
Step 3: Step 3:
.br .br
Last chance to abort. Press Enter to start REAL WRITING. Last chance to abort. Enter the word 'yes' to start REAL WRITING.
.br .br
yes
.br .br
Looking for mount points of sde: Looking for mount points of sde:
.br .br
@ -398,7 +403,8 @@ This overrides device names and option \-list_all.
The found device is then shown with advice, vendor, and model. The found device is then shown with advice, vendor, and model.
.br .br
Option \-DO_WRITE is obeyed if given. Option \-DO_WRITE is obeyed if given.
In this case a final Enter key is demanded before writing begins. In this case, the word 'yes' has to be entered to let unmounting and writing
begin.
.TP .TP
\fB\-list_all\fR \fB\-list_all\fR
Print list of all found devices with advice, vendor and model. One per line. Print list of all found devices with advice, vendor and model. One per line.

View File

@ -50,8 +50,8 @@ If a single plausible candidate is detected, then the program is willing
to copy a disk image file onto it. This will overwrite or make to copy a disk image file onto it. This will overwrite or make
inaccessible the previous partition table and all previous data content inaccessible the previous partition table and all previous data content
of the target device. of the target device.
*Superuser power* is needed for filesystem type identification, for *Superuser power* is normally needed for filesystem type identification,
possible unmounting, and for possible image writing. Option for possible unmounting, and for possible image writing. Option
*-with_sudo* offers a way to gain this power only for those tasks and to *-with_sudo* offers a way to gain this power only for those tasks and to
run the program elsewise with a normal user's power. run the program elsewise with a normal user's power.
If a particular disk image file is intended as copy source, then its If a particular disk image file is intended as copy source, then its
@ -106,7 +106,7 @@ data storage, and - if tested - of sufficient or plausible size.
*reasoning* is a blank separated list of words with either suffix '+' *reasoning* is a blank separated list of words with either suffix '+'
for an inviting device property or '-' for a prohibitive property. for an inviting device property or '-' for a prohibitive property.
Normally a single '-' reason disqualifies the device from being Normally a single '-' reason disqualifies the device from being
advisable. Only if option -look_for_iso is given, a reason "has_...-" advisable. Only if option -look_for_iso is given, a reason "has_XYZ-"
can be overridden by the presence of an ISO 9660 filesystem on the can be overridden by the presence of an ISO 9660 filesystem on the
device. device.
*info* is composed from VENDOR and MODEL as told by lsblk. *info* is composed from VENDOR and MODEL as told by lsblk.
@ -160,7 +160,7 @@ Only if a single new device is found, the program will go on as if a
single device name was given. Option -list_all and any device names single device name was given. Option -list_all and any device names
given as arguments will be ignored. given as arguments will be ignored.
*Step 3* happens only if options -DO_WRITE or -dummy_force are given. *Step 3* happens only if options -DO_WRITE or -dummy_force are given.
The program asks for a final press of the Enter key before real or The program asks for a final input of the word 'yes' before real or
simulated writing begins. simulated writing begins.
Example: Example:
$ xorriso-dd-target -with_sudo -plug_test $ xorriso-dd-target -with_sudo -plug_test
@ -169,6 +169,8 @@ Caused by option -plug_test: Attempt to find the desired device by
watching it appear after being plugged in. watching it appear after being plugged in.
Step 1: Step 1:
Please make sure that the desired target device is plugged _out_ now. Please make sure that the desired target device is plugged _out_ now.
If it is currently plugged in, make sure to unmount all its fileystems
and then unplug it.
Press the Enter key when ready. Press the Enter key when ready.
@ -203,10 +205,9 @@ $ xorriso-dd-target -with_sudo -plug_test -DO_WRITE \
sde : YES : usb+ has_iso9660+ has_vfat+ sde : YES : usb+ has_iso9660+ has_vfat+
Step 3: Step 3:
Last chance to abort. Press Enter to start REAL WRITING. Last chance to abort. Enter the word 'yes' to start REAL WRITING.
yes
Looking for mount points of sde:
Looking for mount points of sde:
/dev/sde1 on /mnt/iso type iso9660 (ro,relatime) /dev/sde1 on /mnt/iso type iso9660 (ro,relatime)
/dev/sde2 on /mnt/fat type vfat (rw,...,errors=remount-ro) /dev/sde2 on /mnt/fat type vfat (rw,...,errors=remount-ro)
Unmounted: /dev/sde1 Unmounted: /dev/sde1
@ -323,8 +324,8 @@ File: xorriso-dd-target.info, Node: Options, Next: Examples, Prev: Overview,
and to press Enter again. and to press Enter again.
This overrides device names and option -list_all. The found device This overrides device names and option -list_all. The found device
is then shown with advice, vendor, and model. is then shown with advice, vendor, and model.
Option -DO_WRITE is obeyed if given. In this case a final Enter Option -DO_WRITE is obeyed if given. In this case, the word 'yes'
key is demanded before writing begins. has to be entered to let unmounting and writing begin.
-list_all -list_all
Print list of all found devices with advice, vendor and model. One Print list of all found devices with advice, vendor and model. One
per line. Ignore any device names. Ignore -DO_WRITE. per line. Ignore any device names. Ignore -DO_WRITE.
@ -499,20 +500,20 @@ File: xorriso-dd-target.info, Node: ConceptIdx, Next: Top, Prev: CommandIdx,
Tag Table: Tag Table:
Node: Top429 Node: Top429
Node: Overview996 Node: Overview996
Node: Simplenames2779 Node: Simplenames2788
Node: Listall3390 Node: Listall3399
Node: Givendevices4800 Node: Givendevices4809
Node: Plugtest5602 Node: Plugtest5611
Node: Dowrite7350 Node: Dowrite7451
Node: Unwise8457 Node: Unwise8566
Node: Reasons9813 Node: Reasons9922
Node: Options12111 Node: Options12220
Node: Examples14713 Node: Examples14840
Node: Files14886 Node: Files15013
Node: Seealso15044 Node: Seealso15171
Node: Bugreport15210 Node: Bugreport15337
Node: Legal15796 Node: Legal15923
Node: CommandIdx16500 Node: CommandIdx16627
Node: ConceptIdx17547 Node: ConceptIdx17674
 
End Tag Table End Tag Table

View File

@ -128,10 +128,10 @@ If a single plausible candidate is detected, then the program is willing to
copy a disk image file onto it. This will overwrite or make inaccessible the copy a disk image file onto it. This will overwrite or make inaccessible the
previous partition table and all previous data content of the target device. previous partition table and all previous data content of the target device.
@* @*
@strong{Superuser power} is needed for filesystem type identification, for @strong{Superuser power} is normally needed for filesystem type identification,
possible unmounting, and for possible image writing. Option @strong{-with_sudo} for possible unmounting, and for possible image writing.
offers a way to gain this power only for those tasks and to run the program Option @strong{-with_sudo} offers a way to gain this power only for those
elsewise with a normal user's power. tasks and to run the program elsewise with a normal user's power.
@* @*
If a particular disk image file is intended as copy source, then If a particular disk image file is intended as copy source, then
its path should be given by option -image_file, so that its size can be used its path should be given by option -image_file, so that its size can be used
@ -206,7 +206,7 @@ storage, and - if tested - of sufficient or plausible size.
@strong{reasoning} is a blank separated list of words with either suffix '+' @strong{reasoning} is a blank separated list of words with either suffix '+'
for an inviting device property or '-' for a prohibitive property. Normally for an inviting device property or '-' for a prohibitive property. Normally
a single '-' reason disqualifies the device from being advisable. Only if a single '-' reason disqualifies the device from being advisable. Only if
option -look_for_iso is given, a reason "has_...-" can be overridden by option -look_for_iso is given, a reason "has_XYZ-" can be overridden by
the presence of an ISO 9660 filesystem on the device. the presence of an ISO 9660 filesystem on the device.
@* @*
@strong{info} is composed from VENDOR and MODEL as told by lsblk. @strong{info} is composed from VENDOR and MODEL as told by lsblk.
@ -276,7 +276,7 @@ device name was given. Option -list_all and any device names given as arguments
will be ignored. will be ignored.
@* @*
@strong{Step 3} happens only if options -DO_WRITE or -dummy_force are given. @strong{Step 3} happens only if options -DO_WRITE or -dummy_force are given.
The program asks for a final press of the Enter key before real or simulated The program asks for a final input of the word 'yes' before real or simulated
writing begins. writing begins.
@* @*
Example: Example:
@ -291,6 +291,11 @@ by watching it appear after being plugged in.
Step 1: Step 1:
@* @*
Please make sure that the desired target device is plugged _out_ now. Please make sure that the desired target device is plugged _out_ now.
@*
If it is currently plugged in, make sure to unmount all its fileystems
@*
and then unplug it.
@*
Press the Enter key when ready. Press the Enter key when ready.
@* @*
@ -338,9 +343,9 @@ sde : YES : usb+ has_iso9660+ has_vfat+
@* @*
Step 3: Step 3:
@* @*
Last chance to abort. Press Enter to start REAL WRITING. Last chance to abort. Enter the word 'yes' to start REAL WRITING.
@* @*
yes
@* @*
Looking for mount points of sde: Looking for mount points of sde:
@* @*
@ -516,7 +521,8 @@ This overrides device names and option -list_all.
The found device is then shown with advice, vendor, and model. The found device is then shown with advice, vendor, and model.
@* @*
Option -DO_WRITE is obeyed if given. Option -DO_WRITE is obeyed if given.
In this case a final Enter key is demanded before writing begins. In this case, the word 'yes' has to be entered to let unmounting and writing
begin.
@c man .TP @c man .TP
@item -list_all @item -list_all
@kindex -list_all print list of disk devices @kindex -list_all print list of disk devices