New xorriso-dd-target option -trust_lsblk_udev

This commit is contained in:
Thomas Schmitt 2020-02-12 16:06:49 +01:00
parent 49690fcac7
commit 1170a9b883
5 changed files with 78 additions and 26 deletions

View File

@ -15,7 +15,7 @@
# announces. # announces.
xdt_print_version() { xdt_print_version() {
echo "xorriso-dd-target , version 1.5.3 , 2020.01.08.204757" echo "xorriso-dd-target , version 1.5.3 , 2020.02.12.145929"
} }
@ -123,6 +123,10 @@ xdt_print_usage() {
echo " If no filesystems are detected and the program" echo " If no filesystems are detected and the program"
echo " has no superuser power, the device is not advised." echo " has no superuser power, the device is not advised."
echo " If -DO_WRITE is given, run umount and dd by sudo." echo " If -DO_WRITE is given, run umount and dd by sudo."
echo " -trust_lsblk_udev Suppress the reason no_fs_while_not_su- if lsblk"
echo " is linked with libudev.so. In this case it is very"
echo " likely that lsblk can retrieve FSTYPE even if"
echo " run by a non-priviledged user."
echo " -image_file PATH Set the path of the image file which shall be" echo " -image_file PATH Set the path of the image file which shall be"
echo " written to a device. Its size will be set as" echo " written to a device. Its size will be set as"
echo " -min_size." echo " -min_size."
@ -220,6 +224,7 @@ xdt_reset_job() {
xdt_dummy_force= xdt_dummy_force=
xdt_no_pacifier= xdt_no_pacifier=
xdt_do_plug_test= xdt_do_plug_test=
xdt_trust_lsblk_udev=
# Status # Status
xdt_sudo_cmd= xdt_sudo_cmd=
@ -233,6 +238,7 @@ xdt_reset_job() {
} }
## Predict superuser power. Possibly enable sudo with lsblk -o FSTYPE and dd. ## Predict superuser power. Possibly enable sudo with lsblk -o FSTYPE and dd.
## Also predict whether lsblk -o FSTYPE will bring results as non-root.
xdt_predict_su_power() { xdt_predict_su_power() {
if test "$(whoami)" = "root" if test "$(whoami)" = "root"
then then
@ -251,6 +257,16 @@ xdt_predict_su_power() {
return 11 return 11
fi fi
fi fi
# lsblk linked with libudev.so usually can obtain filesystem info
# without superuser powers.
if test -n "$xdt_trust_lsblk_udev"
then
if ldd "$xdt_lsblk_cmd" | grep '\tlibudev\.so' >/dev/null
then
xdt_lsblk_fs_wo_su=y
fi
fi
return 0 return 0
} }
@ -308,6 +324,9 @@ xdt_arg_interpreter() {
elif test "X$xdt_i" = "X-look_for_iso" elif test "X$xdt_i" = "X-look_for_iso"
then then
xdt_look_for_iso=y xdt_look_for_iso=y
elif test "X$xdt_i" = "X-trust_lsblk_udev"
then
xdt_trust_lsblk_udev=y
elif test "X$xdt_i" = "X-with_sudo" elif test "X$xdt_i" = "X-with_sudo"
then then
xdt_with_sudo=y xdt_with_sudo=y
@ -604,7 +623,7 @@ xdt_list_devices() {
# Decide whether the found filesystems look dispensible enough # Decide whether the found filesystems look dispensible enough
xdt_reasons="${xdt_reasons}${xdt_good_fs}${xdt_bad_fs}" xdt_reasons="${xdt_reasons}${xdt_good_fs}${xdt_bad_fs}"
if test "${xdt_bad_fs}${xdt_good_fs}" = "" \ if test "${xdt_bad_fs}${xdt_good_fs}" = "" \
&& test -z "$xdt_have_su_power" && test -z "$xdt_have_su_power" && test -z "$xdt_lsblk_fs_wo_su"
then then
xdt_yucky=y xdt_yucky=y
xdt_reasons="${xdt_reasons}no_fs_while_not_su- " xdt_reasons="${xdt_reasons}no_fs_while_not_su- "

View File

@ -9,7 +9,7 @@
.\" First parameter, NAME, should be all caps .\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1) .\" other parameters are allowed: see man(7), man(1)
.TH XORRISO-DD-TARGET 1 "Version 1.5.3, Jan 7, 2020" .TH XORRISO-DD-TARGET 1 "Version 1.5.3, Fep 12, 2020"
.\" Please adjust this date whenever revising the manpage. .\" Please adjust this date whenever revising the manpage.
.\" .\"
.\" Some roff macros, for reference: .\" Some roff macros, for reference:
@ -498,6 +498,16 @@ program as superuser.
If \-DO_WRITE \-with_sudo is given, then the programs umount and dd will be run If \-DO_WRITE \-with_sudo is given, then the programs umount and dd will be run
by sudo, too. by sudo, too.
.TP .TP
\fB\-trust_lsblk_udev\fR
Suppress the reason no_fs_while_not_su\- if lsblk is linked with libudev.so.
In this case it is likely that lsblk can retrieve FSTYPE even if run
by a non\-priviledged user.
.br
This option is intended for use by frontend programs which are certain
that they do not encounter a udev\-using version of lsblk which nevertheless
fails to detect existing filesystems. Human users should better acquire
superuser powers if reason no_fs_while_not_su\- is reported.
.TP
\fB\-image_file\fR PATH \fB\-image_file\fR PATH
Set the path of the image file which shall be written to a device. Its size Set the path of the image file which shall be written to a device. Its size
will be set as \-min_size. will be set as \-min_size.

View File

@ -387,6 +387,15 @@ File: xorriso-dd-target.info, Node: Options, Next: Examples, Prev: Overview,
need to run the whole program as superuser. need to run the whole program as superuser.
If -DO_WRITE -with_sudo is given, then the programs umount and dd If -DO_WRITE -with_sudo is given, then the programs umount and dd
will be run by sudo, too. will be run by sudo, too.
-trust_lsblk_udev
Suppress the reason no_fs_while_not_su- if lsblk is linked with
libudev.so. In this case it is likely that lsblk can retrieve
FSTYPE even if run by a non-priviledged user.
This option is intended for use by frontend programs which are
certain that they do not encounter a udev-using version of lsblk
which nevertheless fails to detect existing filesystems. Human
users should better acquire superuser powers if reason
no_fs_while_not_su- is reported.
-image_file PATH -image_file PATH
Set the path of the image file which shall be written to a device. Set the path of the image file which shall be written to a device.
Its size will be set as -min_size. Its size will be set as -min_size.
@ -491,19 +500,20 @@ File: xorriso-dd-target.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal
[index] [index]
* Menu: * Menu:
* -DO_WRITE write image file to device: Options. (line 48) * -DO_WRITE write image file to device: Options. (line 57)
* -dummy report but do not perform: Options. (line 59) * -dummy report but do not perform: Options. (line 68)
* -dummy_force show raw copy commands: Options. (line 61) * -dummy_force show raw copy commands: Options. (line 70)
* -help print help text to stdout: Options. (line 68) * -help print help text to stdout: Options. (line 77)
* -image_file set path of disk image file: Options. (line 45) * -image_file set path of disk image file: Options. (line 54)
* -list_all print list of disk devices: Options. (line 15) * -list_all print list of disk devices: Options. (line 15)
* -list_long print extra device info: Options. (line 18) * -list_long print extra device info: Options. (line 18)
* -look_for_iso demand presence of ISO 9660: Options. (line 33) * -look_for_iso demand presence of ISO 9660: Options. (line 33)
* -max_size set size limit for device: Options. (line 24) * -max_size set size limit for device: Options. (line 24)
* -min_size set size limit for device: Options. (line 29) * -min_size set size limit for device: Options. (line 29)
* -no_pacifier do not show dd progress: Options. (line 55) * -no_pacifier do not show dd progress: Options. (line 64)
* -plug_test detect target device plugging: Options. (line 7) * -plug_test detect target device plugging: Options. (line 7)
* -version print version text to stdout: Options. (line 65) * -trust_lsblk_udev suppress no_fs_while_not_su-: Options. (line 45)
* -version print version text to stdout: Options. (line 74)
* -with_sudo run lsblk, umount, dd by sudo: Options. (line 38) * -with_sudo run lsblk, umount, dd by sudo: Options. (line 38)
* -with_vendor_model add drive info to advice: Options. (line 22) * -with_vendor_model add drive info to advice: Options. (line 22)
@ -517,21 +527,22 @@ File: xorriso-dd-target.info, Node: ConceptIdx, Next: Top, Prev: CommandIdx,
* Menu: * Menu:
* Bugs, reporting: Bugreport. (line 6) * Bugs, reporting: Bugreport. (line 6)
* dd progress, do not show, -no_pacifier: Options. (line 55) * dd progress, do not show, -no_pacifier: Options. (line 64)
* Device info, print extra, -list_long: Options. (line 18) * Device info, print extra, -list_long: Options. (line 18)
* Device size, set limit, -max_size: Options. (line 24) * Device size, set limit, -max_size: Options. (line 24)
* Device size, set limit, -min_size: Options. (line 29) * Device size, set limit, -min_size: Options. (line 29)
* Disk devices, print list, -list_all: Options. (line 15) * Disk devices, print list, -list_all: Options. (line 15)
* disk image file, set path, -image_file: Options. (line 45) * disk image file, set path, -image_file: Options. (line 54)
* disk image file, write to device, -DO_WRITE: Options. (line 48) * disk image file, write to device, -DO_WRITE: Options. (line 57)
* Drive info, add to advice, -with_vendor_model: Options. (line 22) * Drive info, add to advice, -with_vendor_model: Options. (line 22)
* help text, print to stdout, -help: Options. (line 68) * help text, print to stdout, -help: Options. (line 77)
* ISO 9660, demand presence on target, -look_for_iso: Options. (line 33) * ISO 9660, demand presence on target, -look_for_iso: Options. (line 33)
* lsblk, umount, dd, run by sudo, -with_sudo: Options. (line 38) * lsblk, umount, dd, run by sudo, -with_sudo: Options. (line 38)
* only report, do not perform, -dummy: Options. (line 59) * only report, do not perform, -dummy: Options. (line 68)
* Problems, reporting: Bugreport. (line 6) * Problems, reporting: Bugreport. (line 6)
* raw copy commands, show, -dummy_force: Options. (line 61) * raw copy commands, show, -dummy_force: Options. (line 70)
* Reasons, list of: Reasons. (line 6) * Reasons, list of: Reasons. (line 6)
* suppress no_fs_while_not_su-, -trust_lsblk_udev: Options. (line 45)
* Target device, detect by plugging, -plug_test: Options. (line 7) * Target device, detect by plugging, -plug_test: Options. (line 7)
* Use case, detect intended device by plugging: Plugtest. (line 6) * Use case, detect intended device by plugging: Plugtest. (line 6)
* Use case, evaluate particular given devices: Givendevices. (line 6) * Use case, evaluate particular given devices: Givendevices. (line 6)
@ -540,7 +551,7 @@ File: xorriso-dd-target.info, Node: ConceptIdx, Next: Top, Prev: CommandIdx,
* Use case, show commands for writing to a not advised device: Unwise. * Use case, show commands for writing to a not advised device: Unwise.
(line 6) (line 6)
* Use case, write image to an advised device: Dowrite. (line 6) * Use case, write image to an advised device: Dowrite. (line 6)
* version text, print to stdout, -version: Options. (line 65) * version text, print to stdout, -version: Options. (line 74)
* xorriso-dd-target, options: Options. (line 6) * xorriso-dd-target, options: Options. (line 6)
@ -556,12 +567,12 @@ Node: Dowrite7955
Node: Unwise9336 Node: Unwise9336
Node: Reasons10958 Node: Reasons10958
Node: Options13539 Node: Options13539
Node: Examples16636 Node: Examples17147
Node: Files16809 Node: Files17320
Node: Seealso16967 Node: Seealso17478
Node: Bugreport17133 Node: Bugreport17644
Node: Legal17720 Node: Legal18231
Node: CommandIdx18431 Node: CommandIdx18942
Node: ConceptIdx19697 Node: ConceptIdx20281
 
End Tag Table End Tag Table

View File

@ -50,7 +50,7 @@
@c man .\" First parameter, NAME, should be all caps @c man .\" First parameter, NAME, should be all caps
@c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection @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 .\" other parameters are allowed: see man(7), man(1)
@c man .TH XORRISO-DD-TARGET 1 "Version 1.5.3, Jan 7, 2020" @c man .TH XORRISO-DD-TARGET 1 "Version 1.5.3, Fep 12, 2020"
@c man .\" Please adjust this date whenever revising the manpage. @c man .\" Please adjust this date whenever revising the manpage.
@c man .\" @c man .\"
@c man .\" Some roff macros, for reference: @c man .\" Some roff macros, for reference:
@ -630,6 +630,18 @@ program as superuser.
If -DO_WRITE -with_sudo is given, then the programs umount and dd will be run If -DO_WRITE -with_sudo is given, then the programs umount and dd will be run
by sudo, too. by sudo, too.
@c man .TP @c man .TP
@item -trust_lsblk_udev
@kindex -trust_lsblk_udev suppress no_fs_while_not_su-
@cindex suppress no_fs_while_not_su-, -trust_lsblk_udev
Suppress the reason no_fs_while_not_su- if lsblk is linked with libudev.so.
In this case it is likely that lsblk can retrieve FSTYPE even if run
by a non-priviledged user.
@*
This option is intended for use by frontend programs which are certain
that they do not encounter a udev-using version of lsblk which nevertheless
fails to detect existing filesystems. Human users should better acquire
superuser powers if reason no_fs_while_not_su- is reported.
@c man .TP
@item -image_file PATH @item -image_file PATH
@kindex -image_file set path of disk image file @kindex -image_file set path of disk image file
@cindex disk image file, set path, -image_file @cindex disk image file, set path, -image_file

View File

@ -1 +1 @@
#define Xorriso_timestamP "2020.01.20.132834" #define Xorriso_timestamP "2020.02.12.145929"