From 0767d029ec454264eb4466425d4213839b8f056d Mon Sep 17 00:00:00 2001 From: Urban Wallasch Date: Thu, 16 Apr 2020 10:15:12 +0200 Subject: [PATCH] * Allow running the script with insufficient privileges, but issue a warning. --- XbpsUI.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/XbpsUI.sh b/XbpsUI.sh index bc8fa90..2adf5e0 100755 --- a/XbpsUI.sh +++ b/XbpsUI.sh @@ -26,12 +26,15 @@ done # Make sure we can actually do anything meaningful: SUDO='' if (( $EUID != 0 )); then - if ! command -pv "sudo" > /dev/null ; then - echo 'The `sudo´ command is required but not installed, aborting!' - echo 'Alternatively you may run this script as root.' - exit 99 + if ! sudo -l xbps-install >/dev/null 2>&1 ; then + echo 'WARNING: The `sudo´ command is not available or you have' + echo 'insufficient privileges. You will not be able to make changes' + echo 'to the package system, unless you re-run this script as root.' + echo -e '\nPress ENTER to continue ...' + read + else + SUDO='sudo' fi - SUDO='sudo' fi # Check/install essential prerequisites: -- 2.30.2