aboutsummaryrefslogtreecommitdiffstats
path: root/polkit/Makefile
blob: 7e54e86863a5645157488c877799dd5d25503ebe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Copyright (C) 2013 THE isodumper'S COPYRIGHT HOLDER
# This file is distributed under the same license as the isodumper package.

# This Makefile is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

# Author isodumper software= papoteur <papoteur@mageialinux-online.org>
# Author Makefile file= Yuri Chornoivan <yurchor@ukr.net>

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\n'\
	'#\n'\
	'\n'\
	'# Copyright (C) 2013 THE isodumper`S COPYRIGHT HOLDER\n'\
	'# This file is distributed under the same license as the isodumper package.\n'\
	'\n'\
	'# Author isodumper software= papoteur <papoteur@mageialinux-online.org>\n'\
	'# Author binary polkit file= Geiger David <david.david@mageialinux-online.org>\n'\
	'\n'\
	'if  [[ "$$UID" != "0" ]] ; then\n'\
	'    exec $(BINDIR)/pkexec $(LIBEXECDIR)/$@ "$$USER $$''@"\n'\
	'else\n'\
	'    exec $(LIBEXECDIR)/$@ "$$USER $$''@"\n'\
	'fi\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)