aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2018-11-13 20:41:10 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2018-11-13 20:41:10 +0000
commitfe135b820483b369b51c9dbf860793289a51811d (patch)
tree8324a00e4485ee32f31b94248cf7e8535789fb01
parent5709e009a6ca69fa9cb8963aeb26cae7403afd3c (diff)
downloadqarepo-fe135b820483b369b51c9dbf860793289a51811d.tar
qarepo-fe135b820483b369b51c9dbf860793289a51811d.tar.gz
qarepo-fe135b820483b369b51c9dbf860793289a51811d.tar.bz2
qarepo-fe135b820483b369b51c9dbf860793289a51811d.tar.xz
qarepo-fe135b820483b369b51c9dbf860793289a51811d.zip
Add the qarepo-helper script and its associated polkit rules/actions.
-rw-r--r--org.mageia.qarepo-helper.policy22
-rw-r--r--org.mageia.qarepo-helper.rules10
-rwxr-xr-xqarepo-helper6
3 files changed, 38 insertions, 0 deletions
diff --git a/org.mageia.qarepo-helper.policy b/org.mageia.qarepo-helper.policy
new file mode 100644
index 0000000..bc5b24d
--- /dev/null
+++ b/org.mageia.qarepo-helper.policy
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE policyconfig PUBLIC
+"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
+"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
+<policyconfig>
+
+ <vendor>Mageia</vendor>
+ <vendor_url>http://www.mageia.org/</vendor_url>
+
+ <action id="org.mageia.qarepo-helper.pkexec.run">
+ <description>Run QA Repo helper script</description>
+ <message>Authentication is required to enable or disable the QA Repo local repository</message>
+ <icon_name>drakconf</icon_name>
+ <defaults>
+ <allow_any>no</allow_any>
+ <allow_inactive>no</allow_inactive>
+ <allow_active>auth_admin_keep</allow_active>
+ </defaults>
+ <annotate key="org.freedesktop.policykit.exec.path">/usr/libexec/qarepo-helper</annotate>
+ <annotate key="org.freedesktop.policykit.exec.allow_gui">false</annotate>
+ </action>
+</policyconfig>
diff --git a/org.mageia.qarepo-helper.rules b/org.mageia.qarepo-helper.rules
new file mode 100644
index 0000000..8408234
--- /dev/null
+++ b/org.mageia.qarepo-helper.rules
@@ -0,0 +1,10 @@
+polkit.addRule(function(action, subject) {
+ if (action.id == "org.mageia.qarepo-helper.pkexec.run" &&
+ subject.local && subject.active &&
+ subject.isInGroup("qarepo")) {
+ return polkit.Result.YES;
+ } else {
+ return polkit.Result.AUTH_ADMIN_KEEP;
+ }
+});
+
diff --git a/qarepo-helper b/qarepo-helper
new file mode 100755
index 0000000..00107fa
--- /dev/null
+++ b/qarepo-helper
@@ -0,0 +1,6 @@
+#!/bin/sh
+case $1 in
+ disable) /usr/sbin/urpmi.removemedia "QA Testing ($2-bit)";;
+ enable) /usr/sbin/urpmi.addmedia --update "QA Testing ($2-bit)" $3;;
+ update) /usr/sbin/urpmi.update "QA Testing ($2-bit)";;
+esac