diff options
-rw-r--r-- | org.mageia.qarepo-helper.policy | 22 | ||||
-rw-r--r-- | org.mageia.qarepo-helper.rules | 10 | ||||
-rwxr-xr-x | qarepo-helper | 6 |
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 |