From 1170a9b883abeee7fb51380be748f8a9b64d70d2 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 12 Feb 2020 16:06:49 +0100 Subject: [PATCH] New xorriso-dd-target option -trust_lsblk_udev --- xorriso-dd-target/xorriso-dd-target | 23 +++++++++- xorriso-dd-target/xorriso-dd-target.1 | 12 +++++- xorriso-dd-target/xorriso-dd-target.info | 53 ++++++++++++++---------- xorriso-dd-target/xorriso-dd-target.texi | 14 ++++++- xorriso/xorriso_timestamp.h | 2 +- 5 files changed, 78 insertions(+), 26 deletions(-) diff --git a/xorriso-dd-target/xorriso-dd-target b/xorriso-dd-target/xorriso-dd-target index 5522ecaf..34c91fca 100755 --- a/xorriso-dd-target/xorriso-dd-target +++ b/xorriso-dd-target/xorriso-dd-target @@ -15,7 +15,7 @@ # announces. 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 " has no superuser power, the device is not advised." 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 " written to a device. Its size will be set as" echo " -min_size." @@ -220,6 +224,7 @@ xdt_reset_job() { xdt_dummy_force= xdt_no_pacifier= xdt_do_plug_test= + xdt_trust_lsblk_udev= # Status xdt_sudo_cmd= @@ -233,6 +238,7 @@ xdt_reset_job() { } ## 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() { if test "$(whoami)" = "root" then @@ -251,6 +257,16 @@ xdt_predict_su_power() { return 11 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 } @@ -308,6 +324,9 @@ xdt_arg_interpreter() { elif test "X$xdt_i" = "X-look_for_iso" then 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" then xdt_with_sudo=y @@ -604,7 +623,7 @@ xdt_list_devices() { # Decide whether the found filesystems look dispensible enough xdt_reasons="${xdt_reasons}${xdt_good_fs}${xdt_bad_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 xdt_yucky=y xdt_reasons="${xdt_reasons}no_fs_while_not_su- " diff --git a/xorriso-dd-target/xorriso-dd-target.1 b/xorriso-dd-target/xorriso-dd-target.1 index 1c5b4f91..5ff1659f 100644 --- a/xorriso-dd-target/xorriso-dd-target.1 +++ b/xorriso-dd-target/xorriso-dd-target.1 @@ -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, Jan 7, 2020" +.TH XORRISO-DD-TARGET 1 "Version 1.5.3, Fep 12, 2020" .\" Please adjust this date whenever revising the manpage. .\" .\" 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 by sudo, too. .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 Set the path of the image file which shall be written to a device. Its size will be set as \-min_size. diff --git a/xorriso-dd-target/xorriso-dd-target.info b/xorriso-dd-target/xorriso-dd-target.info index 4d1827b3..93125e59 100644 --- a/xorriso-dd-target/xorriso-dd-target.info +++ b/xorriso-dd-target/xorriso-dd-target.info @@ -387,6 +387,15 @@ File: xorriso-dd-target.info, Node: Options, Next: Examples, Prev: Overview, need to run the whole program as superuser. If -DO_WRITE -with_sudo is given, then the programs umount and dd 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 Set the path of the image file which shall be written to a device. Its size will be set as -min_size. @@ -491,19 +500,20 @@ File: xorriso-dd-target.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal [index] * Menu: -* -DO_WRITE write image file to device: Options. (line 48) -* -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 68) -* -image_file set path of disk image file: Options. (line 45) +* -DO_WRITE write image file to device: Options. (line 57) +* -dummy report but do not perform: Options. (line 68) +* -dummy_force show raw copy commands: Options. (line 70) +* -help print help text to stdout: Options. (line 77) +* -image_file set path of disk image file: Options. (line 54) * -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) +* -no_pacifier do not show dd progress: Options. (line 64) * -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_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: * 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 size, set limit, -max_size: Options. (line 24) * Device size, set limit, -min_size: Options. (line 29) * Disk devices, print list, -list_all: Options. (line 15) -* disk image file, set path, -image_file: Options. (line 45) -* disk image file, write to device, -DO_WRITE: Options. (line 48) +* disk image file, set path, -image_file: Options. (line 54) +* disk image file, write to device, -DO_WRITE: Options. (line 57) * 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) * 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) -* raw copy commands, show, -dummy_force: Options. (line 61) +* raw copy commands, show, -dummy_force: Options. (line 70) * 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) * Use case, detect intended device by plugging: Plugtest. (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. (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) @@ -556,12 +567,12 @@ Node: Dowrite7955 Node: Unwise9336 Node: Reasons10958 Node: Options13539 -Node: Examples16636 -Node: Files16809 -Node: Seealso16967 -Node: Bugreport17133 -Node: Legal17720 -Node: CommandIdx18431 -Node: ConceptIdx19697 +Node: Examples17147 +Node: Files17320 +Node: Seealso17478 +Node: Bugreport17644 +Node: Legal18231 +Node: CommandIdx18942 +Node: ConceptIdx20281  End Tag Table diff --git a/xorriso-dd-target/xorriso-dd-target.texi b/xorriso-dd-target/xorriso-dd-target.texi index 6a8c2167..2fc8809a 100644 --- a/xorriso-dd-target/xorriso-dd-target.texi +++ b/xorriso-dd-target/xorriso-dd-target.texi @@ -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, 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 .\" @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 by sudo, too. @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 @kindex -image_file set path of disk image file @cindex disk image file, set path, -image_file diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 48184369..ce2a11fc 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2020.01.20.132834" +#define Xorriso_timestamP "2020.02.12.145929"