From 37e25d724cfda5417a4ddd03e601fb436573df78 Mon Sep 17 00:00:00 2001 From: "tv@mageia.org" Date: Fri, 29 May 2020 21:50:54 +0200 Subject: Add polkit feature --- Makefile | 8 ++++--- draksnapshot-config | 2 -- org.mageia.draksnapshot-config.policy | 44 +++++++++++++++++++++++++++++++++++ wrapper | 12 ++++++++++ 4 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 org.mageia.draksnapshot-config.policy create mode 100644 wrapper 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 @@ + + + + + Mageia + http://www.mageia.org/ + + + Run Backup Configurator + Authentication is required to run Backup Configurator + draksnapshot-config + + no + no + auth_admin_keep + + /usr/libexec/draksnapshot-config + true + + + + + + + Mageia + http://www.mageia.org/ + + + Run Backup Configurator + Authentication is required to run Backup Configurator + draksnapshot-config + + no + no + auth_admin_keep + + /usr/libexec/draksnapshot-config + true + + 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 "$@" -- cgit v1.2.1