New xorriso-dd-target option -trust_lsblk_udev

This commit is contained in:
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.
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- "