* Allow running the script with insufficient privileges, but issue a warning.
authorUrban Wallasch <urban.wallasch@freenet.de>
Thu, 16 Apr 2020 08:15:12 +0000 (10:15 +0200)
committerUrban Wallasch <urban.wallasch@freenet.de>
Thu, 16 Apr 2020 08:15:12 +0000 (10:15 +0200)
XbpsUI.sh

index bc8fa9010da764bf4f9ea0262bb24d9b71233ead..2adf5e05ffcaace0f777a6ee689a8220b9079023 100755 (executable)
--- 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: