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
1 changed files with 12 additions and 2 deletions

View File

@ -230,8 +230,17 @@ arg_interpreter() {
have_su_power=y
elif test -n "$with_sudo"
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
have_su_power=y
else
echo "FAILURE: Cannot execute program $lsblk_cmd by sudo" >&2
exit 11
fi
fi
}
@ -603,6 +612,7 @@ then
if test -n "$dummy_force" -a -n "$dummy_run" -a "$num_cand" -ne 1
then
# -dummy_force in a situation where the program would normally refuse
echo
echo "Overriding any advice because of -dummy_force"
candidates="$devs"
num_cand=1