On 15/11/13 16:01, Jason St. John wrote:
> 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 <[email protected]>
> ---
> 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."

That else is awful...

How about just:

"${progname} requires root privileges.  Either install sudo or run as root."

or similar.

A
> +                     fi
>                       exit 1
>               else
>                       sudo pacman "$@"
> 


Reply via email to