summaryrefslogtreecommitdiff
path: root/data/Makefile.am
blob: 35a24785fd7c200b6ae7d1081d04d3d0cab8fd63 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
NULL =

BUILT_SOURCES =

dbusconfdir = $(DBUS_SYS_DIR)
dbusconf_DATA = ConsoleKit.conf

seatdir = $(sysconfdir)/ConsoleKit/seats.d
seat_DATA = 00-primary.seat


if HAVE_POLKIT
polkit_policydir = $(datadir)/polkit-1/actions
dist_polkit_policy_DATA =	\
	org.freedesktop.consolekit.policy	\
	$(NULL)
endif

servicedir = $(datadir)/dbus-1/system-services
service_in_files = org.freedesktop.ConsoleKit.service.in
service_DATA = $(service_in_files:.service.in=.service)

$(service_DATA): $(service_in_files) Makefile
	$(edit) $< >$@

edit = sed \
	-e 's|@sbindir[@]|$(sbindir)|g' \
	-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
	-e 's|@localstatedir[@]|$(localstatedir)|g' \
	-e 's|@CONSOLE_KIT_PID_FILE[@]|$(CONSOLE_KIT_PID_FILE)|g'

if HAVE_SYSTEMD
systemdsystemunit_DATA = \
	console-kit-daemon.service \
	console-kit-log-system-start.service \
	console-kit-log-system-stop.service \
	console-kit-log-system-restart.service

console-kit-daemon.service: console-kit-daemon.service.in
	$(edit) $< >$@

console-kit-log-system-start.service: console-kit-log-system-start.service.in
	$(edit) $< >$@

console-kit-log-system-stop.service: console-kit-log-system-stop.service.in
	$(edit) $< >$@

console-kit-log-system-restart.service: console-kit-log-system-restart.service.in
	$(edit) $< >$@

install-data-hook:
	$(MKDIR_P) -m 755 \
		$(DESTDIR)$(systemdsystemunitdir)/basic.target.wants \
		$(DESTDIR)$(systemdsystemunitdir)/halt.target.wants \
		$(DESTDIR)$(systemdsystemunitdir)/poweroff.target.wants \
		$(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants \
		$(DESTDIR)$(systemdsystemunitdir)/kexec.target.wants
	( cd $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants && \
		rm -f console-kit-log-system-start.service && \
		$(LN_S) ../console-kit-log-system-start.service )
	( cd $(DESTDIR)$(systemdsystemunitdir)/halt.target.wants && \
		rm -f console-kit-log-system-stop.service && \
		$(LN_S) ../console-kit-log-system-stop.service )
	( cd $(DESTDIR)$(systemdsystemunitdir)/poweroff.target.wants && \
		rm -f console-kit-log-system-stop.service && \
		$(LN_S) ../console-kit-log-system-stop.service )
	( cd $(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants && \
		rm -f console-kit-log-system-restart.service && \
		$(LN_S) ../console-kit-log-system-restart.service )
	( cd $(DESTDIR)$(systemdsystemunitdir)/kexec.target.wants && \
		rm -f console-kit-log-system-restart.service && \
		$(LN_S) ../console-kit-log-system-restart.service )

edit += \
	-e 's|@SystemdService[@]|SystemdService=console-kit-daemon.service|g'
else
edit += \
	-e 's|@SystemdService[@]||g'
endif


install-data-local: install-logrotate install-90-consolekit
	$(MKDIR_P) $(DESTDIR)$(localstatedir)/log/ConsoleKit/

uninstall-local:: uninstall-logrotate uninstall-90-consolekit
	rmdir --ignore-fail-on-non-empty $(DESTDIR)$(localstatedir)/log/ConsoleKit/

LOGROTATE_CONFS = consolekit.logrotate

XINITRC_CONFS = 90-consolekit

BUILT_SOURCES += \
	$(LOGROTATE_CONFS)	\
	$(XINITRC_CONFS)	\
	$(NULL)

consolekit.logrotate: consolekit.logrotate.in
	sed							\
	    -e 's![@]localstatedir[@]!$(localstatedir)!g'	\
	    < $< > $@-t
	mv $@-t $@

90-consolekit: 90-consolekit.in
	sed							\
	    -e 's![@]CK_LAUNCH_SESSION[@]!CK_LAUNCH_SESSION=$(bindir)/ck-launch-session!g'	\
	    < $< > $@-t
	mv $@-t $@

install-logrotate: $(LOGROTATE_CONFS)
	$(MKDIR_P) $(DESTDIR)$(localstatedir)/log/ConsoleKit/ \
		   $(DESTDIR)$(sysconfdir)/logrotate.d/
	$(INSTALL_DATA) consolekit.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/consolekit

install-90-consolekit: $(XINITRC_CONFS)
	$(MKDIR_P) $(DESTDIR)$(XINITRC_DIR)/
	$(INSTALL_SCRIPT) 90-consolekit $(DESTDIR)$(XINITRC_DIR)

uninstall-logrotate:
	rm -f $(DESTDIR)$(sysconfdir)/logrotate.d/consolekit

uninstall-90-consolekit:
	rm -f $(DESTDIR)$(XINITRC_DIR)/90-consolekit

EXTRA_DIST =						\
	ck-log-system-restart				\
	ck-log-system-start				\
	ck-log-system-stop				\
	$(dbusconf_DATA)				\
	$(seat_DATA)					\
	$(service_in_files)				\
	console-kit-daemon.service.in                   \
	console-kit-log-system-start.service.in         \
	console-kit-log-system-stop.service.in          \
	console-kit-log-system-restart.service.in       \
	90-consolekit.in                                \
	consolekit.logrotate.in                         \
	$(NULL)

MAINTAINERCLEANFILES =			\
	*~				\
	Makefile.in

CLEANFILES =                                            \
	$(service_DATA)                                 \
	$(BUILT_SOURCES)                                \
	console-kit-daemon.service                      \
	console-kit-log-system-start.service        	\
	console-kit-log-system-stop.service     	\
	console-kit-log-system-restart.service