[pacman-dev] [PATCH] pacscripts: Don't ask if sudo is installed; just check for it and inform the user
Jason St. John
jstjohn at purdue.edu
Fri Nov 15 01:01:37 EST 2013
Have pacscripts check if "sudo" is installed when the sudo binary cannot
be found, and remove the "Is sudo installed?" question.
Signed-off-by: Jason St. John <jstjohn at purdue.edu>
---
It doesn't make sense to force the user to run "pacman -Qi sudo", when we can
easily check if sudo is installed automatically and inform the user.
contrib/pacscripts.sh.in | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/contrib/pacscripts.sh.in b/contrib/pacscripts.sh.in
index 8453f9c..7ab7b0d 100644
--- a/contrib/pacscripts.sh.in
+++ b/contrib/pacscripts.sh.in
@@ -71,8 +71,12 @@ spacman() {
pacman "$@"
else
if ! type -p sudo; then
- error "Cannot find the sudo binary! Is sudo installed?"
- error "Otherwise, try to run the program as root"
+ error "Cannot find the sudo binary!"
+ if [ "$(pacman -Qq sudo)" != "sudo" ]; then
+ error "\"sudo\" is not installed. Either install it or run the program as root."
+ else
+ error "However, \"sudo\" appears to be installed. Try running the program as root."
+ fi
exit 1
else
sudo pacman "$@"
--
1.8.4.2
More information about the pacman-dev
mailing list