[PC-BSD Commits] r18390 - pcbsd/current/src-sh/pc-su

svn at pcbsd.org svn at pcbsd.org
Thu Aug 9 07:18:41 PDT 2012


Author: kris
Date: 2012-08-09 14:18:41 +0000 (Thu, 09 Aug 2012)
New Revision: 18390

Modified:
   pcbsd/current/src-sh/pc-su/pc-su
Log:

Use qsu as default switch user utility



Modified: pcbsd/current/src-sh/pc-su/pc-su
===================================================================
--- pcbsd/current/src-sh/pc-su/pc-su	2012-08-09 14:14:12 UTC (rev 18389)
+++ pcbsd/current/src-sh/pc-su/pc-su	2012-08-09 14:18:41 UTC (rev 18390)
@@ -2,49 +2,29 @@
 # Wrapper script which finds the right "su" program
 # to use for graphical root execution
 
-# Figure out which file explorer to use based upon desktop
-if [ "$KDE_FULL_SESSION" = "true" ]; then DE=KDE;
-elif [ ! -z "$GNOME_DESKTOP_SESSION_ID" ]; then DE=GNOME;
-elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=GNOME;
-elif [ "$XDG_MENU_PREFIX" = "xfce-" ] ; then DE=XFCE;
-elif [ "$DESKTOP_SESSION" = "LXDE" ]; then DE=LXDE;
-else DE=""; fi
-
-case $DE in
-   KDE) SUP="kdesu" ;;
- GNOME) SUP="gksu" ;;
-  XFCE) SUP="gksu" ;;
-  LXDE) SUP="gksu" ;;
-     *) # Unknown WM, try some common FE
-        SUP="gksu" ;;
-esac
-
 if [ `id -r -u` != "0" ] ; then
 	VARS="`echo $@`"
 	
-	if [ "$SUP" = "kdesu" ] ; then
-          which kdesu >/dev/null 2>/dev/null
-          if [ "$?" = "0" ] ; then
-                kdesu -t -c "$VARS"
-                exit $? 
-          fi
-          which gksu >/dev/null 2>/dev/null
-          if [ "$?" = "0" ] ; then
-                gksu -a "$VARS"
-                exit $? 
-          fi
-	else
-          which gksu >/dev/null 2>/dev/null
-          if [ "$?" = "0" ] ; then
-                gksu -a "$VARS"
-                exit $? 
-          fi
-          which kdesu >/dev/null 2>/dev/null
-          if [ "$?" = "0" ] ; then
-                kdesu -t -c "$VARS"
-                exit $? 
-          fi
-	fi
+	# Try qsu first, should always be the default
+        which qsu >/dev/null 2>/dev/null
+        if [ $? -eq 0 ] ; then
+           qsu "$VARS"
+           exit $? 
+        fi
+
+	# Now try gksu
+        which gksu >/dev/null 2>/dev/null
+        if [ $? -eq 0 ] ; then
+           gksu -a "$VARS"
+           exit $? 
+        fi
+
+	# Lastly we have kdesu
+        which kdesu >/dev/null 2>/dev/null
+        if [ $? -eq 0 ] ; then
+           kdesu -t -c "$VARS"
+           exit $? 
+        fi
 	
 	# If no utility could be found...
 	echo "No graphical switch-user utility found!"



More information about the Commits mailing list