Reassured success of unmount
This commit is contained in:
parent
23bce9c669
commit
9b711f20ec
@ -512,19 +512,12 @@ list_devices() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_image() {
|
## Puts list of mounted (sub-)devices of $1 into $mounted_devs
|
||||||
|
list_mounted_of() {
|
||||||
if test -z "$umount_cmd"
|
partitions=$($lsblk_cmd -n -p -o NAME /dev/"$1" | grep -v '^'/dev/"$1"'$' \
|
||||||
then
|
|
||||||
echo "No executable program umount found in: $sudo_x_dir_list" >&2
|
|
||||||
return 6
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Looking for mount points of $2:"
|
|
||||||
partitions=$($lsblk_cmd -n -p -o NAME /dev/"$2" | grep -v '^'/dev/"$2"'$' \
|
|
||||||
| sed -e 's/[^a-zA-Z0-9_+@:.,/-]//g' | tr '\n\r' ' ')
|
| sed -e 's/[^a-zA-Z0-9_+@:.,/-]//g' | tr '\n\r' ' ')
|
||||||
mounted_devs=
|
mounted_devs=
|
||||||
for i in /dev/"$2" $partitions
|
for i in /dev/"$1" $partitions
|
||||||
do
|
do
|
||||||
# Show the found mount lines and add their device paths to list
|
# Show the found mount lines and add their device paths to list
|
||||||
mount_line=$(mount | grep '^'"$i"' ')
|
mount_line=$(mount | grep '^'"$i"' ')
|
||||||
@ -534,6 +527,20 @@ write_image() {
|
|||||||
mounted_devs="$mounted_devs $i"
|
mounted_devs="$mounted_devs $i"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
## Does the work of unmounting and dd-ing
|
||||||
|
write_image() {
|
||||||
|
|
||||||
|
if test -z "$umount_cmd"
|
||||||
|
then
|
||||||
|
echo "No executable program umount found in: $sudo_x_dir_list" >&2
|
||||||
|
return 6
|
||||||
|
fi
|
||||||
|
echo "Looking for mount points of $2:"
|
||||||
|
mounted_devs=
|
||||||
|
list_mounted_of "$2"
|
||||||
|
|
||||||
if test -n "$dummy_force"
|
if test -n "$dummy_force"
|
||||||
then
|
then
|
||||||
echo "AGAINST THE ADVICE BY THIS PROGRAM, a daring user could do:"
|
echo "AGAINST THE ADVICE BY THIS PROGRAM, a daring user could do:"
|
||||||
@ -554,13 +561,20 @@ write_image() {
|
|||||||
then
|
then
|
||||||
echo "Unmounted: $i"
|
echo "Unmounted: $i"
|
||||||
else
|
else
|
||||||
echo "FAILURE: Non-zero exit value with: sudo_cmd $umount_cmd $i" >&2
|
echo "FAILURE: Non-zero exit value with: $sudo_cmd $umount_cmd $i" >&2
|
||||||
return 7
|
return 7
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
|
||||||
|
|
||||||
|
# Check again if any mount points still exist
|
||||||
|
list_mounted_of "$2"
|
||||||
|
if test -n "$mounted_devs" -a -z "$dummy_run"
|
||||||
|
then
|
||||||
|
echo "FAILURE: $sudo_cmd $umount_cmd could not remove all mounts: $mounted_devs" >&2
|
||||||
|
return 7
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if test -z "$dd_cmd"
|
if test -z "$dd_cmd"
|
||||||
then
|
then
|
||||||
@ -585,6 +599,8 @@ write_image() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# main()
|
||||||
|
|
||||||
reset_job
|
reset_job
|
||||||
arg_interpreter "$@"
|
arg_interpreter "$@"
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" IMPORTANT NOTE:
|
.\" IMPORTANT NOTE:
|
||||||
.\"
|
.\"
|
||||||
.\" The original of this file is kept in xorriso/xorriso-tcltk.texi
|
.\" The original of this file is kept in xorriso/xorriso-dd-target.texi
|
||||||
.\" This here was generated by program xorriso/make_xorriso_1
|
.\" This here was generated by program xorriso/make_xorriso_1
|
||||||
.\"
|
.\"
|
||||||
.\"
|
.\"
|
||||||
@ -53,7 +53,7 @@ possible unmounting, and for possible image writing. Option \fB\-with_sudo\fR
|
|||||||
offers a way to gain this power only for those tasks and to run the program
|
offers a way to gain this power only for those tasks and to run the program
|
||||||
elsewise with a normal user's power.
|
elsewise with a normal user's power.
|
||||||
.br
|
.br
|
||||||
If a particular disk image file is intended as eventual 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
|
||||||
as decision criterion.
|
as decision criterion.
|
||||||
.PP
|
.PP
|
||||||
@ -223,7 +223,7 @@ Example:
|
|||||||
.br
|
.br
|
||||||
$ xorriso\-dd\-target \-with_sudo \-plug_test \-DO_WRITE \\
|
$ xorriso\-dd\-target \-with_sudo \-plug_test \-DO_WRITE \\
|
||||||
.br
|
.br
|
||||||
> \-image_file debian\-live\-10.0.0\-amd64\-xfce.iso
|
\-image_file debian\-live\-10.0.0\-amd64\-xfce.iso
|
||||||
.br
|
.br
|
||||||
... sudo messages and above plug test steps 1 and 2 ...
|
... sudo messages and above plug test steps 1 and 2 ...
|
||||||
.br
|
.br
|
||||||
@ -269,7 +269,7 @@ Example:
|
|||||||
.br
|
.br
|
||||||
$ xorriso\-dd\-target \-with_sudo \-dummy_force sdd \\
|
$ xorriso\-dd\-target \-with_sudo \-dummy_force sdd \\
|
||||||
.br
|
.br
|
||||||
> \-image_file debian\-live\-10.0.0\-amd64\-xfce.iso
|
\-image_file debian\-live\-10.0.0\-amd64\-xfce.iso
|
||||||
.br
|
.br
|
||||||
...
|
...
|
||||||
.br
|
.br
|
||||||
@ -484,7 +484,7 @@ Copyright (c) 2019 Thomas Schmitt
|
|||||||
.br
|
.br
|
||||||
Permission is granted to distribute this text freely. It shall only be
|
Permission is granted to distribute this text freely. It shall only be
|
||||||
modified in sync with the technical properties of xorriso\-dd\-target.
|
modified in sync with the technical properties of xorriso\-dd\-target.
|
||||||
If you make use of the license to derive modified versions of xorriso\-idd\-target
|
If you make use of the license to derive modified versions of xorriso\-dd\-target
|
||||||
then you are entitled to modify this text under that same license.
|
then you are entitled to modify this text under that same license.
|
||||||
.SH CREDITS
|
.SH CREDITS
|
||||||
\fBxorriso\-dd\-target\fR is developed in cooperation with Nio Wiklund alias
|
\fBxorriso\-dd\-target\fR is developed in cooperation with Nio Wiklund alias
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
This is xorriso-dd-target.info, produced by makeinfo version 5.2 from
|
This is xorriso-dd-target.info, produced by makeinfo version 5.2 from
|
||||||
xorriso-dd-target.texi.
|
xorriso-dd-target.texi.
|
||||||
|
|
||||||
xorriso-tcltk - Device evaluator and disk image copier for GNU/Linux
|
xorriso-dd-target - Device evaluator and disk image copier for GNU/Linux
|
||||||
|
|
||||||
Copyright (C) 2019 Thomas Schmitt
|
Copyright (C) 2019 Thomas Schmitt
|
||||||
|
|
||||||
@ -54,9 +54,9 @@ of the target device.
|
|||||||
possible unmounting, and for possible image writing. Option
|
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 eventual copy source,
|
If a particular disk image file is intended as copy source, then its
|
||||||
then its path should be given by option -image_file, so that its size
|
path should be given by option -image_file, so that its size can be used
|
||||||
can be used as decision criterion.
|
as decision criterion.
|
||||||
|
|
||||||
Following are use case descriptions with examples:
|
Following are use case descriptions with examples:
|
||||||
* Menu:
|
* Menu:
|
||||||
@ -197,7 +197,7 @@ Option *-dummy* prevents this kind of real action and rather shows the
|
|||||||
planned umount and dd commands on stdout.
|
planned umount and dd commands on stdout.
|
||||||
Example:
|
Example:
|
||||||
$ xorriso-dd-target -with_sudo -plug_test -DO_WRITE \
|
$ xorriso-dd-target -with_sudo -plug_test -DO_WRITE \
|
||||||
> -image_file debian-live-10.0.0-amd64-xfce.iso
|
-image_file debian-live-10.0.0-amd64-xfce.iso
|
||||||
... sudo messages and above plug test steps 1 and 2 ...
|
... sudo messages and above plug test steps 1 and 2 ...
|
||||||
|
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ device, even if it looks not advisable. I.e. it will show the shell
|
|||||||
commands which the program does not dare to perform.
|
commands which the program does not dare to perform.
|
||||||
Example:
|
Example:
|
||||||
$ xorriso-dd-target -with_sudo -dummy_force sdd \
|
$ xorriso-dd-target -with_sudo -dummy_force sdd \
|
||||||
> -image_file debian-live-10.0.0-amd64-xfce.iso
|
-image_file debian-live-10.0.0-amd64-xfce.iso
|
||||||
...
|
...
|
||||||
sdd : NO : usb+ has_iso9660+ has_vfat+ has_ext2-
|
sdd : NO : usb+ has_iso9660+ has_vfat+ has_ext2-
|
||||||
|
|
||||||
@ -430,7 +430,7 @@ Copyright (c) 2019 Thomas Schmitt
|
|||||||
Permission is granted to distribute this text freely. It shall only be
|
Permission is granted to distribute this text freely. It shall only be
|
||||||
modified in sync with the technical properties of xorriso-dd-target. If
|
modified in sync with the technical properties of xorriso-dd-target. If
|
||||||
you make use of the license to derive modified versions of
|
you make use of the license to derive modified versions of
|
||||||
xorriso-idd-target then you are entitled to modify this text under that
|
xorriso-dd-target then you are entitled to modify this text under that
|
||||||
same license.
|
same license.
|
||||||
|
|
||||||
14.3 Credits
|
14.3 Credits
|
||||||
@ -497,22 +497,22 @@ File: xorriso-dd-target.info, Node: ConceptIdx, Next: Top, Prev: CommandIdx,
|
|||||||
|
|
||||||
|
|
||||||
Tag Table:
|
Tag Table:
|
||||||
Node: Top425
|
Node: Top429
|
||||||
Node: Overview992
|
Node: Overview996
|
||||||
Node: Simplenames2784
|
Node: Simplenames2779
|
||||||
Node: Listall3395
|
Node: Listall3390
|
||||||
Node: Givendevices4805
|
Node: Givendevices4800
|
||||||
Node: Plugtest5607
|
Node: Plugtest5602
|
||||||
Node: Dowrite7355
|
Node: Dowrite7350
|
||||||
Node: Unwise8464
|
Node: Unwise8457
|
||||||
Node: Reasons9822
|
Node: Reasons9813
|
||||||
Node: Options12120
|
Node: Options12111
|
||||||
Node: Examples14722
|
Node: Examples14713
|
||||||
Node: Files14895
|
Node: Files14886
|
||||||
Node: Seealso15053
|
Node: Seealso15044
|
||||||
Node: Bugreport15219
|
Node: Bugreport15210
|
||||||
Node: Legal15805
|
Node: Legal15796
|
||||||
Node: CommandIdx16510
|
Node: CommandIdx16500
|
||||||
Node: ConceptIdx17557
|
Node: ConceptIdx17547
|
||||||
|
|
||||||
End Tag Table
|
End Tag Table
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
@c man .\"
|
@c man .\"
|
||||||
@c man .\" IMPORTANT NOTE:
|
@c man .\" IMPORTANT NOTE:
|
||||||
@c man .\"
|
@c man .\"
|
||||||
@c man .\" The original of this file is kept in xorriso/xorriso-tcltk.texi
|
@c man .\" The original of this file is kept in xorriso/xorriso-dd-target.texi
|
||||||
@c man .\" This here was generated by program xorriso/make_xorriso_1
|
@c man .\" This here was generated by program xorriso/make_xorriso_1
|
||||||
@c man .\"
|
@c man .\"
|
||||||
@c man .\"
|
@c man .\"
|
||||||
@ -66,7 +66,7 @@
|
|||||||
@c man .nh
|
@c man .nh
|
||||||
@c man-ignore-lines begin
|
@c man-ignore-lines begin
|
||||||
@copying
|
@copying
|
||||||
xorriso-tcltk - Device evaluator and disk image copier for GNU/Linux
|
xorriso-dd-target - Device evaluator and disk image copier for GNU/Linux
|
||||||
|
|
||||||
Copyright @copyright{} 2019 Thomas Schmitt
|
Copyright @copyright{} 2019 Thomas Schmitt
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ possible unmounting, and for possible image writing. Option @strong{-with_sudo}
|
|||||||
offers a way to gain this power only for those tasks and to run the program
|
offers a way to gain this power only for those tasks and to run the program
|
||||||
elsewise with a normal user's power.
|
elsewise with a normal user's power.
|
||||||
@*
|
@*
|
||||||
If a particular disk image file is intended as eventual 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
|
||||||
as decision criterion.
|
as decision criterion.
|
||||||
@sp 1
|
@sp 1
|
||||||
@ -328,7 +328,7 @@ Example:
|
|||||||
@*
|
@*
|
||||||
$ xorriso-dd-target -with_sudo -plug_test -DO_WRITE \
|
$ xorriso-dd-target -with_sudo -plug_test -DO_WRITE \
|
||||||
@*
|
@*
|
||||||
> -image_file debian-live-10.0.0-amd64-xfce.iso
|
-image_file debian-live-10.0.0-amd64-xfce.iso
|
||||||
@*
|
@*
|
||||||
... sudo messages and above plug test steps 1 and 2 ...
|
... sudo messages and above plug test steps 1 and 2 ...
|
||||||
@*
|
@*
|
||||||
@ -377,7 +377,7 @@ Example:
|
|||||||
@*
|
@*
|
||||||
$ xorriso-dd-target -with_sudo -dummy_force sdd \
|
$ xorriso-dd-target -with_sudo -dummy_force sdd \
|
||||||
@*
|
@*
|
||||||
> -image_file debian-live-10.0.0-amd64-xfce.iso
|
-image_file debian-live-10.0.0-amd64-xfce.iso
|
||||||
@*
|
@*
|
||||||
...
|
...
|
||||||
@*
|
@*
|
||||||
@ -644,7 +644,7 @@ Copyright (c) 2019 Thomas Schmitt
|
|||||||
@*
|
@*
|
||||||
Permission is granted to distribute this text freely. It shall only be
|
Permission is granted to distribute this text freely. It shall only be
|
||||||
modified in sync with the technical properties of xorriso-dd-target.
|
modified in sync with the technical properties of xorriso-dd-target.
|
||||||
If you make use of the license to derive modified versions of xorriso-idd-target
|
If you make use of the license to derive modified versions of xorriso-dd-target
|
||||||
then you are entitled to modify this text under that same license.
|
then you are entitled to modify this text under that same license.
|
||||||
@c man .SH CREDITS
|
@c man .SH CREDITS
|
||||||
@section Credits
|
@section Credits
|
||||||
|
Loading…
Reference in New Issue
Block a user