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