forked from pool/xdg-utils
This commit is contained in:
parent
189efcaab4
commit
a93648f11a
162
xdg-su.diff
162
xdg-su.diff
@ -710,166 +710,8 @@
|
|||||||
+detectDE
|
+detectDE
|
||||||
+
|
+
|
||||||
+if [ x"$DE" = x"" ]; then
|
+if [ x"$DE" = x"" ]; then
|
||||||
+ XSU=`which xsu 2>/dev/null`
|
+ which xterm 2>/dev/null >&2
|
||||||
+ if [ $? -eq 0 ] ; then
|
+ if [ $? -eq 0 -a -n "$DISPLAY" ] ; then
|
||||||
+ DE=generic
|
|
||||||
+ fi
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+case "$DE" in
|
|
||||||
+ kde)
|
|
||||||
+ su_kde
|
|
||||||
+ ;;
|
|
||||||
+
|
|
||||||
+ gnome)
|
|
||||||
+ su_gnome
|
|
||||||
+ ;;
|
|
||||||
+
|
|
||||||
+ generic)
|
|
||||||
+ su_generic
|
|
||||||
+ ;;
|
|
||||||
+
|
|
||||||
+ *)
|
|
||||||
+ [ x"$user" = x"" ] && user=root
|
|
||||||
+ exit_failure_operation_impossible "no graphical method available for invoking '$cmd' as '$user'"
|
|
||||||
+ ;;
|
|
||||||
+esac
|
|
||||||
--- scripts/xdg-su.in
|
|
||||||
+++ scripts/xdg-su.in
|
|
||||||
@@ -0,0 +1,155 @@
|
|
||||||
+#!/bin/sh
|
|
||||||
+#---------------------------------------------
|
|
||||||
+# xdg-su
|
|
||||||
+#
|
|
||||||
+# Utility script to run a command as an alternate user, generally
|
|
||||||
+# the root user, with a graphical prompt for the root
|
|
||||||
+# password if needed
|
|
||||||
+#
|
|
||||||
+# Refer to the usage() function below for usage.
|
|
||||||
+#
|
|
||||||
+# Copyright 2006, Jeremy White <jwhite@codeweavers.com>
|
|
||||||
+# Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at>
|
|
||||||
+#
|
|
||||||
+# LICENSE:
|
|
||||||
+#
|
|
||||||
+#---------------------------------------------
|
|
||||||
+
|
|
||||||
+manualpage()
|
|
||||||
+{
|
|
||||||
+cat << _MANUALPAGE
|
|
||||||
+_MANUALPAGE
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+usage()
|
|
||||||
+{
|
|
||||||
+cat << _USAGE
|
|
||||||
+_USAGE
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#@xdg-utils-common@
|
|
||||||
+
|
|
||||||
+su_kde()
|
|
||||||
+{
|
|
||||||
+ KDESU=`which kdesu 2>/dev/null`
|
|
||||||
+ if [ $? -eq 0 ] ; then
|
|
||||||
+ if [ -z "$user" ] ; then
|
|
||||||
+ $KDESU -c "$cmd"
|
|
||||||
+ else
|
|
||||||
+ $KDESU -u "$user" -c "$cmd"
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ if [ $? -eq 0 ]; then
|
|
||||||
+ exit_success
|
|
||||||
+ else
|
|
||||||
+ exit_failure_operation_failed
|
|
||||||
+ fi
|
|
||||||
+ else
|
|
||||||
+ su_generic
|
|
||||||
+ fi
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+su_gnome()
|
|
||||||
+{
|
|
||||||
+ GSU=`which gnomesu 2>/dev/null`
|
|
||||||
+ if [ $? -ne 0 ] ; then
|
|
||||||
+ GSU=`which xsu 2>/dev/null`
|
|
||||||
+ fi
|
|
||||||
+ if [ $? -eq 0 ] ; then
|
|
||||||
+ if [ -z "$user" ] ; then
|
|
||||||
+ $GSU -c "$cmd"
|
|
||||||
+ else
|
|
||||||
+ $GSU -u "$user" -c "$cmd"
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ if [ $? -eq 0 ]; then
|
|
||||||
+ exit_success
|
|
||||||
+ else
|
|
||||||
+ exit_failure_operation_failed
|
|
||||||
+ fi
|
|
||||||
+ else
|
|
||||||
+ su_generic
|
|
||||||
+ fi
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+su_generic()
|
|
||||||
+{
|
|
||||||
+ if [ -z "$user" ] ; then
|
|
||||||
+ xterm -geom 60x5 -T "xdg-su: $cmd" -e su -c "$cmd"
|
|
||||||
+ else
|
|
||||||
+ xterm -geom 60x5 -T "xdg-su: $cmd" -e su -u "$user" -c "$cmd"
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ if [ $? -eq 0 ]; then
|
|
||||||
+ exit_success
|
|
||||||
+ else
|
|
||||||
+ exit_failure_operation_failed
|
|
||||||
+ fi
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+[ x"$1" != x"" ] || exit_failure_syntax
|
|
||||||
+
|
|
||||||
+user=
|
|
||||||
+cmd=
|
|
||||||
+while [ $# -gt 0 ] ; do
|
|
||||||
+ parm="$1"
|
|
||||||
+ shift
|
|
||||||
+
|
|
||||||
+ case "$parm" in
|
|
||||||
+ -u)
|
|
||||||
+ if [ -z "$1" ] ; then
|
|
||||||
+ exit_failure_syntax "user argument missing for -u"
|
|
||||||
+ fi
|
|
||||||
+ user="$1"
|
|
||||||
+ shift
|
|
||||||
+ ;;
|
|
||||||
+
|
|
||||||
+ -c)
|
|
||||||
+ if [ -z "$1" ] ; then
|
|
||||||
+ exit_failure_syntax "command argument missing for -c"
|
|
||||||
+ fi
|
|
||||||
+ cmd="$1"
|
|
||||||
+ shift
|
|
||||||
+ ;;
|
|
||||||
+
|
|
||||||
+ -*)
|
|
||||||
+ exit_failure_syntax "unexpected option '$parm'"
|
|
||||||
+ ;;
|
|
||||||
+
|
|
||||||
+ *)
|
|
||||||
+ exit_failure_syntax "unexpected argument '$parm'"
|
|
||||||
+ ;;
|
|
||||||
+ esac
|
|
||||||
+done
|
|
||||||
+
|
|
||||||
+if [ -z "${cmd}" ] ; then
|
|
||||||
+ exit_failure_syntax "command missing"
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+detectDE
|
|
||||||
+
|
|
||||||
+if [ x"$DE" = x"" ]; then
|
|
||||||
+ XSU=`which xsu 2>/dev/null`
|
|
||||||
+ if [ $? -eq 0 ] ; then
|
|
||||||
+ DE=generic
|
+ DE=generic
|
||||||
+ fi
|
+ fi
|
||||||
+fi
|
+fi
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Sep 20 18:57:34 CEST 2007 - dmueller@suse.de
|
||||||
|
|
||||||
|
- fix xdg-su outside KDE/GNOME (#309164)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Aug 30 11:35:02 CEST 2007 - dmueller@suse.de
|
Thu Aug 30 11:35:02 CEST 2007 - dmueller@suse.de
|
||||||
|
|
||||||
|
@ -16,9 +16,9 @@ License: X11/MIT
|
|||||||
Group: System/GUI/Other
|
Group: System/GUI/Other
|
||||||
Summary: Utilities to uniformly interface desktop environments
|
Summary: Utilities to uniformly interface desktop environments
|
||||||
Version: 1.0.1
|
Version: 1.0.1
|
||||||
Release: 74
|
Release: 84
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
URL: http://portland.freedesktop.org/
|
Url: http://portland.freedesktop.org/
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
Source0: %name-%{version}.tar.bz2
|
Source0: %name-%{version}.tar.bz2
|
||||||
Patch0: xdg-su.diff
|
Patch0: xdg-su.diff
|
||||||
@ -80,8 +80,9 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{_mandir}/man1/xdg-open.1.gz
|
%{_mandir}/man1/xdg-open.1.gz
|
||||||
%{_mandir}/man1/xdg-su.1.gz
|
%{_mandir}/man1/xdg-su.1.gz
|
||||||
%{_mandir}/man1/xdg-screensaver.1.gz
|
%{_mandir}/man1/xdg-screensaver.1.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Sep 20 2007 - dmueller@suse.de
|
||||||
|
- fix xdg-su outside KDE/GNOME (#309164)
|
||||||
* Thu Aug 30 2007 - dmueller@suse.de
|
* Thu Aug 30 2007 - dmueller@suse.de
|
||||||
- fix xdg-su for XFCE (#304753)
|
- fix xdg-su for XFCE (#304753)
|
||||||
* Tue May 22 2007 - dmueller@suse.de
|
* Tue May 22 2007 - dmueller@suse.de
|
||||||
|
Loading…
Reference in New Issue
Block a user