From: Urban Wallasch Date: Thu, 16 Apr 2020 08:15:12 +0000 (+0200) Subject: * Allow running the script with insufficient privileges, but issue a warning. X-Git-Url: https://git.packet-gain.de/?a=commitdiff_plain;h=0767d029ec454264eb4466425d4213839b8f056d;p=xbpsui.git * Allow running the script with insufficient privileges, but issue a warning. --- 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: