]>
Commit | Line | Data |
---|---|---|
88d14a22 CP |
1 | # |
2 | # Makefile for the security policy. | |
3 | # | |
4 | # Targets: | |
5 | # | |
6 | # install - compile and install the policy configuration, and context files. | |
7 | # load - compile, install, and load the policy configuration. | |
8 | # reload - compile, install, and load/reload the policy configuration. | |
9 | # relabel - relabel filesystems based on the file contexts configuration. | |
10 | # checklabels - check filesystems against the file context configuration | |
11 | # restorelabels - check filesystems against the file context configuration | |
12 | # and restore the label of files with incorrect labels | |
13 | # policy - compile the policy configuration locally for testing/development. | |
14 | # | |
15 | # The default target is 'policy'. | |
16 | # | |
17 | ||
b4cd1533 CP |
18 | ######################################## |
19 | # | |
20 | # Configurable portions of the Makefile | |
21 | # | |
22 | ||
b67488e3 CP |
23 | # Override default policy version |
24 | OUTPUT_POLICY = 18 | |
134191be | 25 | |
b67488e3 CP |
26 | # Policy Type |
27 | # strict, targeted, strict-mls, targeted-mls | |
28 | # strict and strict-mls are currently supported. | |
29 | TYPE = strict | |
b4cd1533 | 30 | |
b67488e3 CP |
31 | # If set, this will be used as the policy |
32 | # name. Otherwise the policy type will be | |
33 | # used for the name. | |
34 | NAME = | |
35 | ||
36 | # Build monolithic policy. Putting n here | |
37 | # will build a loadable module policy. | |
38 | # Only monolithic policies are currently supported. | |
39 | MONOLITHIC=y | |
b4cd1533 CP |
40 | |
41 | # Uncomment this to disable command echoing | |
42 | #QUIET:=@ | |
43 | ||
44 | ######################################## | |
45 | # | |
b67488e3 | 46 | # NO OPTIONS BELOW HERE |
b4cd1533 CP |
47 | # |
48 | ||
49 | # executable paths | |
50 | PREFIX := /usr | |
51 | BINDIR := $(PREFIX)/bin | |
52 | SBINDIR := $(PREFIX)/sbin | |
53 | CHECKPOLICY := $(BINDIR)/checkpolicy | |
547283e2 | 54 | LOADPOLICY := $(SBINDIR)/load_policy |
b4cd1533 | 55 | SETFILES := $(SBINDIR)/setfiles |
1beba1c6 | 56 | GENHOMEDIRCON := $(SBINDIR)/genhomedircon |
0447352a | 57 | |
c7b41e95 CP |
58 | CFLAGS := -Wall |
59 | ||
3a80ec29 | 60 | SUPPORT := support |
95db4228 | 61 | GENXML := $(SUPPORT)/segenxml.py |
3a80ec29 | 62 | GENDOC := $(SUPPORT)/sedoctool.py |
254bbc7b | 63 | FCSORT := $(SUPPORT)/fc_sort |
84eb353c | 64 | SETTUN := $(SUPPORT)/set_tunables |
3a80ec29 | 65 | |
004db90d | 66 | XMLLINT := $(BINDIR)/xmllint |
b4cd1533 | 67 | |
134191be | 68 | # enable MLS if requested. |
b67488e3 | 69 | ifneq ($(findstring mls,$(TYPE)),) |
134191be CP |
70 | override M4PARAM += -D enable_mls |
71 | CHECKPOLICY += -M | |
72 | endif | |
73 | ||
b67488e3 CP |
74 | # compile targeted policy if requested. |
75 | ifneq ($(findstring targeted,$(TYPE)),) | |
76 | override M4PARAM += -D targeted_policy | |
77 | endif | |
78 | ||
79 | ifeq ($(MONOLITHIC),y) | |
80 | override M4PARAM += -D monolithic_policy | |
81 | endif | |
82 | ||
83 | ifneq ($(OUTPUT_POLICY),) | |
84 | CHECKPOLICY += -c $(OUTPUT_POLICY) | |
85 | endif | |
86 | ||
87 | ifeq ($(NAME),) | |
88 | NAME := $(TYPE) | |
134191be CP |
89 | endif |
90 | ||
b4cd1533 | 91 | # determine the policy version and current kernel version if possible |
134191be | 92 | PV := $(shell $(CHECKPOLICY) -V |cut -f 1 -d ' ') |
b4cd1533 CP |
93 | KV := $(shell cat /selinux/policyvers) |
94 | ||
95 | # dont print version warnings if we are unable to determine | |
96 | # the currently running kernel's policy version | |
97 | ifeq ($(KV),) | |
134191be | 98 | KV := $(PV) |
b4cd1533 CP |
99 | endif |
100 | ||
101 | FC := file_contexts | |
102 | POLVER := policy.$(PV) | |
b4cd1533 CP |
103 | |
104 | # install paths | |
105 | TOPDIR = $(DESTDIR)/etc/selinux | |
b67488e3 | 106 | INSTALLDIR = $(TOPDIR)/$(NAME) |
b4cd1533 CP |
107 | POLICYPATH = $(INSTALLDIR)/policy |
108 | SRCPATH = $(INSTALLDIR)/src | |
109 | USERPATH = $(INSTALLDIR)/users | |
110 | CONTEXTPATH = $(INSTALLDIR)/contexts | |
111 | LOADPATH = $(POLICYPATH)/$(POLVER) | |
112 | FCPATH = $(CONTEXTPATH)/files/file_contexts | |
113 | HOMEDIRPATH = $(CONTEXTPATH)/files/homedir_template | |
114 | ||
b67488e3 CP |
115 | POLDIR = policy |
116 | MODDIR = $(POLDIR)/modules | |
117 | ||
118 | BASE_MODULE = $(MODDIR)/kernel | |
119 | FLASKDIR = $(POLDIR)/flask | |
09693356 | 120 | APPCONF = config/appconfig |
0350b1dc | 121 | M4SUPPORT = $(wildcard $(POLDIR)/support/*.spt) |
b4cd1533 | 122 | |
84eb353c | 123 | GLOBALTUN := $(POLDIR)/global_tunables |
0350b1dc | 124 | MOD_DISABLE := $(POLDIR)/modules.conf |
84eb353c | 125 | TUNABLES := $(POLDIR)/tunables.conf |
0fbe15dc | 126 | |
c9a26b3e | 127 | APPDIR := $(CONTEXTPATH) |
1beba1c6 | 128 | APPFILES := $(addprefix $(APPDIR)/,default_contexts default_type initrc_context failsafe_context userhelper_context removable_context dbus_contexts customizable_types) $(CONTEXTPATH)/files/media $(INSTALLDIR)/booleans |
2926f9c7 | 129 | CONTEXTFILES += $(wildcard $(APPCONF)/*_context*) $(APPCONF)/media |
b67488e3 | 130 | USER_FILES := $(POLDIR)/users |
c9a26b3e | 131 | |
e12e5738 | 132 | DISABLEMOD := $(foreach mod,$(shell egrep -v '^[[:blank:]]*\#' $(MOD_DISABLE)),$(subst ./,,$(shell find -iname $(mod).te))) |
57869a68 | 133 | ALL_LAYERS := $(filter-out $(MODDIR)/CVS,$(shell find $(wildcard $(MODDIR)/*) -maxdepth 0 -type d)) |
e12e5738 CP |
134 | |
135 | GENERATED_TE := $(basename $(foreach dir,$(ALL_LAYERS),$(wildcard $(dir)/*.te.in))) | |
136 | GENERATED_IF := $(basename $(foreach dir,$(ALL_LAYERS),$(wildcard $(dir)/*.if.in))) | |
137 | GENERATED_FC := $(basename $(foreach dir,$(ALL_LAYERS),$(wildcard $(dir)/*.fc.in))) | |
138 | ||
8ae194f6 CP |
139 | # sort here since it removes duplicates, which can happen |
140 | # when a generated file is already generated | |
141 | DETECTED_MODS := $(sort $(foreach dir,$(ALL_LAYERS),$(wildcard $(dir)/*.te)) $(GENERATED_TE)) | |
0fbe15dc | 142 | ALL_MODULES := $(filter-out $(DISABLEMOD),$(DETECTED_MODS)) |
b4cd1533 | 143 | |
b67488e3 | 144 | PRE_TE_FILES := $(addprefix $(FLASKDIR)/,security_classes initial_sids access_vectors) $(M4SUPPORT) $(POLDIR)/mls |
0fbe15dc CP |
145 | ALL_INTERFACES := $(ALL_MODULES:.te=.if) |
146 | ALL_TE_FILES := $(ALL_MODULES) | |
b67488e3 | 147 | POST_TE_FILES := $(POLDIR)/users $(POLDIR)/constraints |
b4cd1533 | 148 | |
0fbe15dc | 149 | ALL_FC_FILES := $(ALL_MODULES:.te=.fc) |
92e928e1 | 150 | HOMEDIR_TEMPLATE = tmp/homedir_template |
b4cd1533 | 151 | |
84eb353c | 152 | POLICY_SECTIONS := tmp/pre_te_files.conf tmp/generated_definitions.conf tmp/all_interfaces.conf tmp/all_attrs_types.conf $(GLOBALTUN) tmp/only_te_rules.conf tmp/all_post.conf |
b4cd1533 | 153 | |
20030ef5 | 154 | DOCS = doc |
12b559a4 | 155 | POLXML = $(DOCS)/policy.xml |
20030ef5 | 156 | XMLDTD = $(DOCS)/policy.dtd |
57869a68 | 157 | LAYERXML = metadata.xml |
20030ef5 CP |
158 | HTMLDIR = $(DOCS)/html |
159 | DOCTEMPLATE = $(DOCS)/templates | |
36e54b81 | 160 | |
b4cd1533 CP |
161 | ######################################## |
162 | # | |
163 | # default action: build policy locally | |
164 | # | |
165 | default: policy | |
166 | ||
167 | policy: $(POLVER) | |
168 | ||
44cda51b | 169 | install: $(LOADPATH) $(FCPATH) $(APPFILES) $(USERPATH)/local.users |
c9a26b3e CP |
170 | |
171 | load: tmp/load | |
b4cd1533 CP |
172 | |
173 | ######################################## | |
174 | # | |
175 | # Build a binary policy locally | |
176 | # | |
177 | $(POLVER): policy.conf | |
b67488e3 | 178 | @echo "Compiling $(NAME) $(POLVER)" |
b4cd1533 CP |
179 | ifneq ($(PV),$(KV)) |
180 | @echo | |
b67488e3 | 181 | @echo "WARNING: Policy version mismatch! Is your OUTPUT_POLICY set correctly?" |
b4cd1533 CP |
182 | @echo |
183 | endif | |
134191be | 184 | $(QUIET) $(CHECKPOLICY) $^ -o $@ |
b4cd1533 CP |
185 | |
186 | ######################################## | |
187 | # | |
188 | # Install a binary policy | |
189 | # | |
190 | $(LOADPATH): policy.conf | |
191 | @mkdir -p $(POLICYPATH) | |
b67488e3 | 192 | @echo "Compiling and installing $(NAME) $(LOADPATH)" |
b4cd1533 CP |
193 | ifneq ($(PV),$(KV)) |
194 | @echo | |
b67488e3 | 195 | @echo "WARNING: Policy version mismatch! Is your OUTPUT_POLICY set correctly?" |
b4cd1533 CP |
196 | @echo |
197 | endif | |
134191be | 198 | $(QUIET) $(CHECKPOLICY) $^ -o $@ |
b4cd1533 | 199 | |
88d14a22 CP |
200 | ######################################## |
201 | # | |
202 | # Load the binary policy | |
203 | # | |
204 | reload tmp/load: $(LOADPATH) $(FCPATH) | |
b67488e3 | 205 | @echo "Loading $(NAME) $(LOADPATH)" |
88d14a22 CP |
206 | $(QUIET) $(LOADPOLICY) -q $(LOADPATH) |
207 | @touch tmp/load | |
208 | ||
b4cd1533 CP |
209 | ######################################## |
210 | # | |
211 | # Construct a monolithic policy.conf | |
212 | # | |
213 | policy.conf: $(POLICY_SECTIONS) | |
b67488e3 | 214 | @echo "Creating $(NAME) policy.conf" |
d2d6c8ce | 215 | # checkpolicy can use the #line directives provided by -s for error reporting: |
b67488e3 | 216 | $(QUIET) m4 $(M4PARAM) -s $^ > tmp/$@.tmp |
b4cd1533 | 217 | $(QUIET) sed -e /^portcon/d -e /^nodecon/d -e /^netifcon/d < tmp/$@.tmp > $@ |
d2d6c8ce | 218 | # the ordering of these ocontexts matters: |
b4cd1533 CP |
219 | $(QUIET) grep ^portcon tmp/$@.tmp >> $@ || true |
220 | $(QUIET) grep ^netifcon tmp/$@.tmp >> $@ || true | |
221 | $(QUIET) grep ^nodecon tmp/$@.tmp >> $@ || true | |
222 | ||
223 | tmp/pre_te_files.conf: $(PRE_TE_FILES) | |
224 | @test -d tmp || mkdir -p tmp | |
225 | $(QUIET) cat $^ > $@ | |
226 | ||
d2d6c8ce CP |
227 | tmp/generated_definitions.conf: $(ALL_LAYERS) $(ALL_TE_FILES) |
228 | # per-userdomain templates: | |
b4cd1533 CP |
229 | @test -d tmp || mkdir -p tmp |
230 | $(QUIET) echo "define(\`per_userdomain_templates',\`" > $@ | |
0fbe15dc | 231 | $(QUIET) for i in $(patsubst %.te,%,$(notdir $(ALL_MODULES))); do \ |
b4cd1533 CP |
232 | echo "ifdef(\`""$$i""_per_userdomain_template',\`""$$i""_per_userdomain_template("'$$1'")')" \ |
233 | >> $@ ;\ | |
234 | done | |
235 | $(QUIET) echo "')" >> $@ | |
d2d6c8ce | 236 | # define foo.te |
0fbe15dc | 237 | $(QUIET) for i in $(notdir $(ALL_MODULES)); do \ |
b4cd1533 CP |
238 | echo "define(\`$$i')" >> $@ ;\ |
239 | done | |
84eb353c | 240 | $(QUIET) $(SETTUN) $(TUNABLES) >> $@ |
b4cd1533 | 241 | |
199895e2 | 242 | tmp/all_interfaces.conf: $(M4SUPPORT) $(ALL_INTERFACES) |
b4cd1533 | 243 | @test -d tmp || mkdir -p tmp |
199895e2 | 244 | $(QUIET) m4 $^ | sed -e s/dollarsstar/\$$\*/g > $@ |
b4cd1533 | 245 | |
3a80ec29 | 246 | tmp/all_te_files.conf: $(ALL_TE_FILES) |
b4cd1533 | 247 | @test -d tmp || mkdir -p tmp |
3a80ec29 | 248 | $(QUIET) cat $^ > $@ |
b4cd1533 CP |
249 | |
250 | tmp/post_te_files.conf: $(POST_TE_FILES) | |
251 | @test -d tmp || mkdir -p tmp | |
252 | $(QUIET) cat $^ > $@ | |
253 | ||
254 | # extract attributes and put them first. extract post te stuff | |
255 | # like genfscon and put last. portcon, nodecon, and netifcon | |
256 | # is delayed since they are generated by m4 | |
f66a1af9 CP |
257 | tmp/all_attrs_types.conf tmp/only_te_rules.conf tmp/all_post.conf: tmp/all_te_files.conf tmp/post_te_files.conf |
258 | $(QUIET) grep ^attribute tmp/all_te_files.conf > tmp/all_attrs_types.conf || true | |
259 | $(QUIET) grep '^type ' tmp/all_te_files.conf >> tmp/all_attrs_types.conf | |
b4cd1533 | 260 | $(QUIET) cat tmp/post_te_files.conf > tmp/all_post.conf |
cabfa520 CP |
261 | $(QUIET) grep '^sid ' tmp/all_te_files.conf >> tmp/all_post.conf || true |
262 | $(QUIET) egrep '^fs_use_(xattr|task|trans)' tmp/all_te_files.conf >> tmp/all_post.conf || true | |
b4cd1533 | 263 | $(QUIET) grep ^genfscon tmp/all_te_files.conf >> tmp/all_post.conf || true |
cabfa520 CP |
264 | $(QUIET) sed -r -e /^attribute/d -e '/^type /d' -e /^genfscon/d \ |
265 | -e '/^sid /d' -e '/^fs_use_(xattr|task|trans)/d' \ | |
266 | < tmp/all_te_files.conf > tmp/only_te_rules.conf | |
b4cd1533 | 267 | |
f2e4ab3a | 268 | $(MODDIR)/kernel/corenetwork.if: $(MODDIR)/kernel/corenetwork.if.m4 $(MODDIR)/kernel/corenetwork.if.in |
61bbe531 CP |
269 | @echo "#" > $@ |
270 | @echo "# This is a generated file! Instead of modifying this file, the" >> $@ | |
271 | @echo "# $(notdir $@).in or $(notdir $@).m4 file should be modified." >> $@ | |
272 | @echo "#" >> $@ | |
273 | $(QUIET) cat $(MODDIR)/kernel/corenetwork.if.in >> $@ | |
f2e4ab3a | 274 | $(QUIET) egrep "^[[:blank:]]*network_(interface|node|port)\(.*\)" $(@:.if=.te).in \ |
d2d6c8ce | 275 | | m4 $(M4PARAM) $(M4SUPPORT) $(MODDIR)/kernel/corenetwork.if.m4 - \ |
f2e4ab3a | 276 | | sed -e 's/dollarsone/\$$1/g' -e 's/dollarszero/\$$0/g' >> $@ |
f2e4ab3a CP |
277 | |
278 | $(MODDIR)/kernel/corenetwork.te: $(MODDIR)/kernel/corenetwork.te.m4 $(MODDIR)/kernel/corenetwork.te.in | |
61bbe531 CP |
279 | @echo "#" > $@ |
280 | @echo "# This is a generated file! Instead of modifying this file, the" >> $@ | |
281 | @echo "# $(notdir $@).in or $(notdir $@).m4 file should be modified." >> $@ | |
282 | @echo "#" >> $@ | |
d2d6c8ce | 283 | $(QUIET) m4 $(M4PARAM) $(M4SUPPORT) $^ \ |
61bbe531 | 284 | | sed -e 's/dollarsone/\$$1/g' -e 's/dollarszero/\$$0/g' >> $@ |
f2e4ab3a | 285 | |
88d14a22 CP |
286 | ######################################## |
287 | # | |
288 | # Remove the dontaudit rules from the policy.conf | |
289 | # | |
290 | enableaudit: policy.conf | |
291 | @test -d tmp || mkdir -p tmp | |
292 | @echo "Removing dontaudit rules from policy.conf" | |
293 | $(QUIET) grep -v dontaudit policy.conf > tmp/policy.audit | |
294 | $(QUIET) mv tmp/policy.audit policy.conf | |
295 | ||
6d314fd3 CP |
296 | ######################################## |
297 | # | |
298 | # Construct file_contexts | |
299 | # | |
92e928e1 | 300 | $(FC): $(M4SUPPORT) tmp/generated_definitions.conf $(ALL_FC_FILES) $(FCSORT) |
6d314fd3 | 301 | @test -d tmp || mkdir -p tmp |
92e928e1 CP |
302 | $(QUIET) m4 $(M4PARAM) $(M4SUPPORT) tmp/generated_definitions.conf $(ALL_FC_FILES) > tmp/$@.tmp |
303 | $(QUIET) grep -e HOME -e ROLE tmp/$@.tmp > $(HOMEDIR_TEMPLATE) | |
304 | $(QUIET) sed -i -e /HOME/d -e /ROLE/d tmp/$@.tmp | |
305 | $(QUIET) $(FCSORT) tmp/$@.tmp $@ | |
6d314fd3 | 306 | |
547283e2 CP |
307 | ######################################## |
308 | # | |
309 | # Install file_contexts | |
310 | # | |
3a80ec29 | 311 | $(FCPATH): $(FC) $(USERPATH)/system.users |
547283e2 CP |
312 | @mkdir -p $(CONTEXTPATH)/files |
313 | $(QUIET) install -m 644 $(FC) $(FCPATH) | |
92e928e1 CP |
314 | $(QUIET) install -m 644 $(HOMEDIR_TEMPLATE) $(HOMEDIRPATH) |
315 | $(QUIET) $(GENHOMEDIRCON) -d $(TOPDIR) -t $(NAME) $(USEPWD) | |
547283e2 | 316 | |
b4cd1533 CP |
317 | ######################################## |
318 | # | |
319 | # Filesystem labeling | |
320 | # | |
88d14a22 | 321 | FILESYSTEMS := `mount | grep -v "context=" | egrep -v '\((|.*,)bind(,.*|)\)' | awk '/(ext[23]| xfs| jfs).*rw/{print $$3}';` |
b4cd1533 | 322 | |
88d14a22 CP |
323 | checklabels: $(FC) $(SETFILES) |
324 | @if test -z "$(FILESYSTEMS)"; then \ | |
325 | echo "No filesystems with extended attributes found!" ;\ | |
326 | false ;\ | |
327 | fi | |
b4cd1533 CP |
328 | $(QUIET) $(SETFILES) -v -n $(FC) $(FILESYSTEMS) |
329 | ||
88d14a22 CP |
330 | restorelabels: $(FC) $(SETFILES) |
331 | @if test -z "$(FILESYSTEMS)"; then \ | |
332 | echo "No filesystems with extended attributes found!" ;\ | |
333 | false ;\ | |
334 | fi | |
b4cd1533 CP |
335 | $(QUIET) $(SETFILES) -v $(FC) $(FILESYSTEMS) |
336 | ||
337 | relabel: $(FC) $(SETFILES) | |
88d14a22 CP |
338 | @if test -z "$(FILESYSTEMS)"; then \ |
339 | echo "No filesystems with extended attributes found!" ;\ | |
340 | false ;\ | |
341 | fi | |
b4cd1533 CP |
342 | $(QUIET) $(SETFILES) $(FC) $(FILESYSTEMS) |
343 | ||
84eb353c CP |
344 | ######################################## |
345 | # | |
346 | # Create config files | |
347 | # | |
d2d6c8ce CP |
348 | conf: $(MOD_DISABLE) $(TUNABLES) $(GENERATED_TE) $(GENERATED_IF) $(GENERATED_FC) |
349 | ||
350 | $(MOD_DISABLE) $(TUNABLES): $(POLXML) | |
84eb353c | 351 | @echo "Creating $(MOD_DISABLE) and $(TUNABLES)" |
12b559a4 | 352 | $(QUIET) cd $(DOCS) && ../$(GENDOC) -t ../$(TUNABLES) -m ../$(MOD_DISABLE) -x ../$(POLXML) |
84eb353c | 353 | |
6d314fd3 CP |
354 | ######################################## |
355 | # | |
356 | # Documentation generation | |
357 | # | |
358 | ||
d2d6c8ce | 359 | # minimal dependencies here, because we don't want to rebuild |
84eb353c CP |
360 | # this and its dependents every time the dependencies |
361 | # change | |
d2d6c8ce | 362 | $(POLXML): $(ALL_INTERFACES) |
88c72f44 | 363 | @echo "Creating $@" |
84eb353c | 364 | @mkdir -p tmp |
004db90d | 365 | $(QUIET) echo '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>' > $@ |
95db4228 CP |
366 | $(QUIET) echo '<!DOCTYPE policy SYSTEM "$(notdir $(XMLDTD))">' >> $@ |
367 | $(QUIET) $(GENXML) -w -m $(LAYERXML) -t $(GLOBALTUN) $(ALL_LAYERS) >> $@ | |
0447352a CP |
368 | $(QUIET) if test -x $(XMLLINT) && test -f $(XMLDTD); then \ |
369 | $(XMLLINT) --noout --dtdvalid $(XMLDTD) $@ ;\ | |
004db90d | 370 | fi |
6d314fd3 | 371 | |
12b559a4 | 372 | html: $(POLXML) |
20030ef5 | 373 | @mkdir -p $(HTMLDIR) |
12b559a4 | 374 | $(QUIET) cd $(DOCS) && ../$(GENDOC) -d ../$(HTMLDIR) -T ../$(DOCTEMPLATE) -x ../$(POLXML) |
20030ef5 CP |
375 | $(QUIET) cp $(DOCTEMPLATE)/*.css $(HTMLDIR) |
376 | ||
c9a26b3e CP |
377 | ######################################## |
378 | # | |
379 | # Runtime binary policy patching of users | |
380 | # | |
381 | $(USERPATH)/system.users: $(USER_FILES) tmp/generated_definitions.conf | |
382 | @mkdir -p $(USERPATH) | |
383 | @echo "Installing system.users" | |
384 | @echo "# " > tmp/system.users | |
385 | @echo "# Do not edit this file. " >> tmp/system.users | |
386 | @echo "# This file is replaced on reinstalls of this policy." >> tmp/system.users | |
387 | @echo "# Please edit local.users to make local changes." >> tmp/system.users | |
388 | @echo "#" >> tmp/system.users | |
389 | $(QUIET) m4 $(M4PARAM) tmp/generated_definitions.conf $(USER_FILES) | \ | |
390 | egrep -v "^[[:space:]]*($$|#)" >> tmp/system.users | |
391 | $(QUIET) install -m 644 tmp/system.users $@ | |
392 | ||
1beba1c6 | 393 | $(USERPATH)/local.users: config/local.users |
c9a26b3e CP |
394 | @mkdir -p $(USERPATH) |
395 | @echo "Installing local.users" | |
c7b41e95 | 396 | $(QUIET) install -b -m 644 $< $@ |
c9a26b3e CP |
397 | |
398 | ######################################## | |
399 | # | |
400 | # Appconfig files | |
401 | # | |
402 | install-appconfig: $(APPFILES) | |
403 | ||
1beba1c6 CP |
404 | $(INSTALLDIR)/booleans: $(TUNABLES) |
405 | @mkdir -p $(INSTALLDIR) | |
406 | $(QUIET) egrep '^[[:blank:]]*[[:alpha:]]' $(TUNABLES) \ | |
407 | | sed -e 's/false/0/g' -e 's/true/1/g' > tmp/booleans | |
408 | $(QUIET) install -m 644 tmp/booleans $@ | |
409 | ||
2926f9c7 | 410 | $(CONTEXTPATH)/files/media: $(APPCONF)/media |
1beba1c6 CP |
411 | @mkdir -p $(CONTEXTPATH)/files/ |
412 | $(QUIET) install -m 644 $< $@ | |
c9a26b3e | 413 | |
2926f9c7 | 414 | $(APPDIR)/default_contexts: $(APPCONF)/default_contexts |
1beba1c6 CP |
415 | @mkdir -p $(APPDIR) |
416 | $(QUIET) install -m 644 $< $@ | |
c9a26b3e | 417 | |
2926f9c7 | 418 | $(APPDIR)/removable_context: $(APPCONF)/removable_context |
1beba1c6 CP |
419 | @mkdir -p $(APPDIR) |
420 | $(QUIET) install -m 644 $< $@ | |
c9a26b3e CP |
421 | |
422 | $(APPDIR)/customizable_types: policy.conf | |
1beba1c6 CP |
423 | @mkdir -p $(APPDIR) |
424 | $(QUIET) grep "^type .*customizable" $< | cut -d',' -f1 | cut -d' ' -f2 > tmp/customizable_types | |
425 | $(QUIET) install -m 644 tmp/customizable_types $@ | |
c9a26b3e | 426 | |
2926f9c7 | 427 | $(APPDIR)/default_type: $(APPCONF)/default_type |
1beba1c6 CP |
428 | @mkdir -p $(APPDIR) |
429 | $(QUIET) install -m 644 $< $@ | |
c9a26b3e | 430 | |
2926f9c7 | 431 | $(APPDIR)/userhelper_context: $(APPCONF)/userhelper_context |
1beba1c6 CP |
432 | @mkdir -p $(APPDIR) |
433 | $(QUIET) install -m 644 $< $@ | |
c9a26b3e | 434 | |
2926f9c7 | 435 | $(APPDIR)/initrc_context: $(APPCONF)/initrc_context |
1beba1c6 CP |
436 | @mkdir -p $(APPDIR) |
437 | $(QUIET) install -m 644 $< $@ | |
c9a26b3e | 438 | |
2926f9c7 | 439 | $(APPDIR)/failsafe_context: $(APPCONF)/failsafe_context |
1beba1c6 CP |
440 | @mkdir -p $(APPDIR) |
441 | $(QUIET) install -m 644 $< $@ | |
c9a26b3e | 442 | |
2926f9c7 | 443 | $(APPDIR)/dbus_contexts: $(APPCONF)/dbus_contexts |
1beba1c6 CP |
444 | @mkdir -p $(APPDIR) |
445 | $(QUIET) install -m 644 $< $@ | |
c9a26b3e | 446 | |
2926f9c7 | 447 | $(APPDIR)/users/root: $(APPCONF)/root_default_contexts |
1beba1c6 CP |
448 | @mkdir -p $(APPDIR)/users |
449 | $(QUIET) install -m 644 $< $@ | |
c9a26b3e | 450 | |
c592e52e CP |
451 | ######################################## |
452 | # | |
453 | # Install policy sources | |
454 | # | |
455 | install-src: | |
456 | rm -rf $(SRCPATH)/policy.old | |
457 | -mv $(SRCPATH)/policy $(SRCPATH)/policy.old | |
458 | mkdir -p $(SRCPATH)/policy | |
459 | cp -R . $(SRCPATH)/policy | |
460 | ||
102a59ba CP |
461 | ######################################## |
462 | # | |
463 | # Clean the sources | |
464 | # | |
b4cd1533 CP |
465 | clean: |
466 | rm -fR tmp | |
467 | rm -f policy.conf | |
468 | rm -f policy.$(PV) | |
469 | rm -f $(FC) | |
470 | ||
102a59ba CP |
471 | ######################################## |
472 | # | |
473 | # Clean everything | |
474 | # | |
0fbe15dc | 475 | bare: clean |
12b559a4 | 476 | rm -f $(POLXML) |
254bbc7b CP |
477 | rm -f $(SUPPORT)/*.pyc |
478 | rm -f $(FCSORT) | |
0fbe15dc CP |
479 | rm -f $(MOD_DISABLE) |
480 | rm -f $(TUNABLES) | |
20030ef5 | 481 | rm -fR $(HTMLDIR) |
e12e5738 CP |
482 | ifneq ($(GENERATED_TE),) |
483 | rm -f $(GENERATED_TE) | |
484 | endif | |
485 | ifneq ($(GENERATED_IF),) | |
486 | rm -f $(GENERATED_IF) | |
487 | endif | |
488 | ifneq ($(GENERATED_FC),) | |
489 | rm -f $(GENERATED_FC) | |
490 | endif | |
0fbe15dc | 491 | |
102a59ba | 492 | .PHONY: default policy install load reload enableaudit checklabels restorelabels relabel conf clean bare |