From d21a459a1cc8ba267d96af1a5cd619ecc937cde8 Mon Sep 17 00:00:00 2001
From: Yuri Chornoivan <yurchor@ukr.net>
Date: Mon, 23 Dec 2013 19:33:01 +0200
Subject: Really use translations for polkit file

---
 Makefile                                           | 10 +++++---
 polkit/Makefile                                    | 24 +++++++++++++++++
 polkit/org.mageia.isodumper.policy.in              |  8 ------
 share/polkit-1/actions/org.mageia.isodumper.policy | 30 ----------------------
 4 files changed, 31 insertions(+), 41 deletions(-)
 create mode 100644 polkit/Makefile
 delete mode 100644 share/polkit-1/actions/org.mageia.isodumper.policy

diff --git a/Makefile b/Makefile
index a945b76..4be6194 100644
--- a/Makefile
+++ b/Makefile
@@ -25,10 +25,14 @@ PIXMAPSDIR=$(PREFIX)/share/pixmaps
 LOCALEDIR=$(PREFIX)
 DOCDIR=$(PREFIX)/share/doc/isodumper
 PYTHON=/usr/bin/env python
+DIRS = polkit
 
+all: dirs
 
-all: isodumper COPYING CHANGELOG
-
+dirs:
+	@for n in . $(DIRS); do \
+		[ "$$n" = "." ] || make -C $$n || cd .. || exit 1 ;\
+	done
 
 clean:
 	rm -f isodumper COPYING CHANGELOG
@@ -48,7 +52,7 @@ install: all
 	# for policy file isodumper on /usr/share/polkit-1/actions/ 
 	# to have authentication with polkit (use for mageia policy)	
 	mkdir -p $(DESTDIR)$(POLKITPOLICYDIR)
-	install -m 644 share/polkit-1/actions/org.mageia.isodumper.policy $(DESTDIR)$(POLKITPOLICYDIR)
+	install -m 644 polkit/org.mageia.isodumper.policy $(DESTDIR)$(POLKITPOLICYDIR)
 
 	# for LIBFILES isodumper.py find_devices
 	mkdir -p $(DESTDIR)$(LIBDIR)/isodumper
diff --git a/polkit/Makefile b/polkit/Makefile
new file mode 100644
index 0000000..dc7c4ba
--- /dev/null
+++ b/polkit/Makefile
@@ -0,0 +1,24 @@
+BINDIR = /usr/bin
+LIBEXECDIR = /usr/libexec
+BINDEST = $(DESTDIR)$(BINDIR)
+POLKITPOLICYDEST = $(DESTDIR)/usr/share/polkit-1/actions
+
+POLICY_IN := $(wildcard *.policy.in)
+POLICY = $(POLICY_IN:.policy.in=.policy)
+WRAPPERS = $(patsubst org.mageia.%.policy,%,$(POLICY))
+
+all: $(WRAPPERS) $(POLICY)
+
+clean:
+	rm -f  $(WRAPPERS) $(POLICY)
+
+%: org.mageia.%.policy.in
+	@echo -e '#!/bin/sh\nif  [[ "$$UID" != "0" ]] ; then\n    exec $(BINDIR)/pkexec $(LIBEXECDIR)/$@ "$$''@"\nelse\n    exec $(LIBEXECDIR)/$@ "$$''@"\nfi\n' > $@
+
+%.policy: %.policy.in
+	intltool-merge --utf8 ../po $< $@ -x -u -c ../po/.intltool-merge-cache
+
+install: all
+	install -d $(BINDEST) $(POLKITPOLICYDEST)
+	install -m755 $(WRAPPERS) $(BINDEST)
+	install -m644 $(POLICY) $(POLKITPOLICYDEST)
diff --git a/polkit/org.mageia.isodumper.policy.in b/polkit/org.mageia.isodumper.policy.in
index 860749d..749aa6f 100644
--- a/polkit/org.mageia.isodumper.policy.in
+++ b/polkit/org.mageia.isodumper.policy.in
@@ -9,15 +9,7 @@
 
  <action id="org.mageia.isodumper.pkexec.run">
     <_description>Run Isodumper</_description>
-    <description xml:lang="fr">Exécuter Isodumper</description>
-    <description xml:lang="ca">Isodumper</description>
-    <description xml:lang="ru">Isodumper</description>
-    <description xml:lang="sl">Isodumper</description>
-    <description xml:lang="tr">Isodumper</description>
-    <description xml:lang="uk">Isodumper</description>
     <_message>Authentication is required to run Isodumper</_message>
-    <message xml:lang="fr">Une authentification est nécessaire pour exécuter IsoDumper</message>
-    <message xml:lang="ca">Per a accedir al Isodumper cal autenticació</message>
     <icon_name>isodumper</icon_name>
     <defaults>
      <allow_any>no</allow_any>
diff --git a/share/polkit-1/actions/org.mageia.isodumper.policy b/share/polkit-1/actions/org.mageia.isodumper.policy
deleted file mode 100644
index 03655f5..0000000
--- a/share/polkit-1/actions/org.mageia.isodumper.policy
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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://mageia.org/</vendor_url>
-
- <action id="org.mageia.isodumper.pkexec.run">
-    <description>Run Isodumper</description>
-    <description xml:lang="fr">Exécuter Isodumper</description>
-    <description xml:lang="ca">Isodumper</description>
-    <description xml:lang="ru">Isodumper</description>
-    <description xml:lang="sl">Isodumper</description>
-    <description xml:lang="tr">Isodumper</description>
-    <description xml:lang="uk">Isodumper</description>
-    <message>Authentication is required to run Isodumper</message>
-    <message xml:lang="fr">Une authentification est nécessaire pour exécuter IsoDumper</message>
-    <message xml:lang="ca">Per a accedir al Isodumper cal autenticació</message>
-    <icon_name>isodumper</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/isodumper</annotate>
-    <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
- </action>
-</policyconfig>
\ No newline at end of file
-- 
cgit v1.2.1