summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv@mageia.org <tv@mageia.org>2020-05-29 21:50:54 +0200
committerNicolas Lécureuil <neoclust@mageia.org>2020-06-02 10:11:08 +0200
commit37e25d724cfda5417a4ddd03e601fb436573df78 (patch)
tree3182758f1c0c8714d1ab88a664393ae9477495fb
parentf14aaecef5b5fa76646960b826b81e2fcdc6f48d (diff)
downloaddraksnapshot-37e25d724cfda5417a4ddd03e601fb436573df78.tar
draksnapshot-37e25d724cfda5417a4ddd03e601fb436573df78.tar.gz
draksnapshot-37e25d724cfda5417a4ddd03e601fb436573df78.tar.bz2
draksnapshot-37e25d724cfda5417a4ddd03e601fb436573df78.tar.xz
draksnapshot-37e25d724cfda5417a4ddd03e601fb436573df78.zip
Add polkit feature
-rw-r--r--Makefile8
-rwxr-xr-xdraksnapshot-config2
-rw-r--r--org.mageia.draksnapshot-config.policy44
-rw-r--r--wrapper12
4 files changed, 61 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 2dd2fd0..d2fcca3 100644
--- a/Makefile
+++ b/Makefile
@@ -28,10 +28,12 @@ clean:
find . -name '*~' | xargs rm -f
install:
- install -d $(PREFIX)/usr/{sbin,bin,share/{mime/packages,$(NAME)/pixmaps,icons/{mini,large}}}
- install -m755 draksnapshot-config $(SBINDIR)
+ install -d $(PREFIX)/usr/{sbin,bin,libexec,share/{mime/packages,$(NAME)/pixmaps,autostart,gnome/autostart,icons/{mini,large},polkit-1/actions}}
+ install -m755 draksnapshot-config $(PREFIX)/usr/libexec/
+ install -m755 wrapper $(BINDIR)/draksnapshot-config
+ install -m644 org.mageia.draksnapshot-config.policy $(PREFIX)/usr/share/polkit-1/actions/
install -m755 draksnapshot-restore $(SBINDIR)
- install -m755 draksnapshot-applet $(BINDIR)
+ install -m755 draksnapshot-applet $(SBINDIR)
install -d $(SYSCONFDIR)
install -m644 icons/$(NAME).png $(ICONSDIR)/mini/$(NAME).png
install -m644 icons/$(NAME).png $(ICONSDIR)/$(NAME).png
diff --git a/draksnapshot-config b/draksnapshot-config
index 127a762..ac0f8d5 100755
--- a/draksnapshot-config
+++ b/draksnapshot-config
@@ -38,8 +38,6 @@ use ugtk2 qw(:create :dialogs :helpers :wrappers);
use Gtk2::SimpleList;
use interactive;
-require_root_capability();
-
ugtk2::add_icon_path("/usr/share/draksnapshot/pixmaps/");
######### read config
diff --git a/org.mageia.draksnapshot-config.policy b/org.mageia.draksnapshot-config.policy
new file mode 100644
index 0000000..31c7766
--- /dev/null
+++ b/org.mageia.draksnapshot-config.policy
@@ -0,0 +1,44 @@
+<?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.draksnapshot-config.pkexec.run">
+ <description>Run Backup Configurator</description>
+ <message>Authentication is required to run Backup Configurator</message>
+ <icon_name>draksnapshot-config</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/draksnapshot-config</annotate>
+ <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
+ </action>
+</policyconfig>
+<?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.draksnapshot-config.pkexec.run">
+ <description>Run Backup Configurator</description>
+ <message>Authentication is required to run Backup Configurator</message>
+ <icon_name>draksnapshot-config</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/draksnapshot-config</annotate>
+ <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
+ </action>
+</policyconfig>
diff --git a/wrapper b/wrapper
new file mode 100644
index 0000000..6882141
--- /dev/null
+++ b/wrapper
@@ -0,0 +1,12 @@
+#!/bin/sh
+if [[ "$UID" != "0" ]] ; then
+ /usr/bin/pkexec /usr/libexec/draksnapshot-config "$@"
+ exit $?
+fi
+exec /usr/libexec/draksnapshot-config "$@"
+#!/bin/sh
+if [[ "$UID" != "0" ]] ; then
+ /usr/bin/pkexec /usr/libexec/draksnapshot-config "$@"
+ exit $?
+fi
+exec /usr/libexec/draksnapshot-config "$@"