[PATCH v2] Make it simple to run yumex without password

39 views
Skip to first unread message

Håkon Løvdal

unread,
Feb 14, 2013, 6:49:12 PM2/14/13
to yu...@googlegroups.com
Yumex already have supported polkit for some time, but this is most likely
not well known by its users. Make it easier to discover and start using
by including configuration file templates.

Since polkit recently have changed it configuration file format (used in
Fedora 18), two versions are included. The pkla file is just copied from
http://www.yumex.dk/2012/05/running-yumex-without-typing-password.html.
The rules file is created by me.

---
misc/10-yumex-without-pw.pkla.template | 14 ++++++++++++++
misc/10-yumex-without-pw.rules.template | 20 ++++++++++++++++++++
yumex.spec | 2 +-
3 files changed, 35 insertions(+), 1 deletion(-)
create mode 100644 misc/10-yumex-without-pw.pkla.template
create mode 100644 misc/10-yumex-without-pw.rules.template

diff --git a/misc/10-yumex-without-pw.pkla.template
b/misc/10-yumex-without-pw.pkla.template
new file mode 100644
index 0000000..4f48bf5
--- /dev/null
+++ b/misc/10-yumex-without-pw.pkla.template
@@ -0,0 +1,14 @@
+#
+# This file is for older versions of polkit, e.g. Fedora 17 and earlier.
+# Copy it to /etc/polkit-1/localauthority/50-local.d/10-yumex-without-pw.pkla
to activate.
+#
+
+# See the polkit(8) man page for more information about configuring polkit.
+
+[Run Yumex without password]
+Identity=unix-user:put_your_username_here
+Action=dk.yumex.backend.*
+ResultAny=no
+ResultInactive=no
+ResultActive=yes
+
diff --git a/misc/10-yumex-without-pw.rules.template
b/misc/10-yumex-without-pw.rules.template
new file mode 100644
index 0000000..ab60d96
--- /dev/null
+++ b/misc/10-yumex-without-pw.rules.template
@@ -0,0 +1,20 @@
+/*
+ * This file is for newer versions of polkit, e.g. Fedora 18 and later.
+ * Copy it to /etc/polkit-1/rules.d/10-yumex-without-pw.rules to activate.
+ */
+
+// See the polkit(8) man page for more information about configuring polkit.
+
+polkit.addRule(function(action, subject) {
+ var prefix = "dk.yumex.backend.";
+ if (action.id.substring(0, prefix.length) == prefix
+ && subject.user == "put_your_username_here") {
+ return polkit.Result.YES;
+ }
+});
+
+/* replace "subject.user == ..." with
+
+ subject.isInGroup("some_group_name") && subject.active
+
+if you do not want to hard code a user name */
diff --git a/yumex.spec b/yumex.spec
index 4516035..94de48c 100644
--- a/yumex.spec
+++ b/yumex.spec
@@ -69,7 +69,7 @@ rm -rf $RPM_BUILD_ROOT

%files -f %{name}.lang
%defattr(-, root, root, -)
-%doc COPYING ChangeLog TODO
+%doc COPYING ChangeLog TODO misc/10-yumex-without-pw.*.template
%{_datadir}/pixmaps/*
%{_datadir}/yumex
%{_bindir}/yumex*
--
1.8.1.2
Reply all
Reply to author
Forward
0 new messages