Running sudo early in order to get the possible password prompt

This commit is contained in:
Thomas Schmitt 2019-11-30 19:49:54 +01:00
parent 099d24f740
commit 9ffb3ff2d5

View File

@ -230,8 +230,17 @@ arg_interpreter() {
have_su_power=y have_su_power=y
elif test -n "$with_sudo" elif test -n "$with_sudo"
then then
echo "Testing sudo to possibly get password prompting done now:"
if sudo $lsblk_cmd -h >/dev/null
then
echo "sudo $lsblk_cmd seems ok."
echo
sudo_cmd=sudo sudo_cmd=sudo
have_su_power=y have_su_power=y
else
echo "FAILURE: Cannot execute program $lsblk_cmd by sudo" >&2
exit 11
fi
fi fi
} }
@ -603,6 +612,7 @@ then
if test -n "$dummy_force" -a -n "$dummy_run" -a "$num_cand" -ne 1 if test -n "$dummy_force" -a -n "$dummy_run" -a "$num_cand" -ne 1
then then
# -dummy_force in a situation where the program would normally refuse # -dummy_force in a situation where the program would normally refuse
echo
echo "Overriding any advice because of -dummy_force" echo "Overriding any advice because of -dummy_force"
candidates="$devs" candidates="$devs"
num_cand=1 num_cand=1