From 185ab24144603c2d630d4388c1a68e0a9bfbad68 Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Fri, 7 Apr 2006 15:01:10 +0000 Subject: [PATCH] fixes for rhel4 genhomedircon. --- refpolicy/Rules.monolithic | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/refpolicy/Rules.monolithic b/refpolicy/Rules.monolithic index b698153f..42c7659f 100644 --- a/refpolicy/Rules.monolithic +++ b/refpolicy/Rules.monolithic @@ -171,8 +171,20 @@ enableaudit: $(POLICY_CONF) # $(FC): $(TMPDIR)/$(notdir $(FC)).tmp $(FCSORT) $(verbose) $(FCSORT) $< $@ +ifeq "$(DISTRO)" "rhel4" +# the old genhomedircon used in RHEL4 makes assumptions on +# the directory strucure of the policy. need to set up a mini +# environment with this structure for correct functioning. + @ mkdir -p $(TMPDIR)/rhel4/file_contexts + @ cp $@ $(TMPDIR)/rhel4/file_contexts + @ $(M4) $(M4PARAM) $(M4SUPPORT) $(USER_FILES) > $(TMPDIR)/rhel4/users + $(verbose) $(GREP) -v "^/root" $< $(TMPDIR)/rhel4/$(@F).root + $(verbose) ( cd $(TMPDIR)/rhel4/users ; $(GENHOMEDIRCON) . $(@F).root > $@ ) + $(verbose) $(GREP) "^/root" $< >> $@ +else $(verbose) $(GREP) -e HOME -e ROLE $@ > $(HOMEDIR_TEMPLATE) $(verbose) $(SED) -i -e /HOME/d -e /ROLE/d $@ +endif $(TMPDIR)/$(notdir $(FC)).tmp: $(M4SUPPORT) $(TMPDIR)/generated_definitions.conf $(ALL_FC_FILES) ifeq ($(ALL_FC_FILES),) @@ -191,9 +203,13 @@ $(FCPATH): $(FC) $(LOADPATH) $(USERPATH)/system.users $(verbose) $(SETFILES) -q -c $(LOADPATH) $(FC) @echo "Installing file_contexts." @mkdir -p $(CONTEXTPATH)/files +ifeq "$(DISTRO)" "rhel4" + $(verbose) install -m $(FC) $@ +else $(verbose) install -m 644 $(FC) $(FCPATH) $(verbose) install -m 644 $(HOMEDIR_TEMPLATE) $(HOMEDIRPATH) $(verbose) $(GENHOMEDIRCON) -d $(TOPDIR) -t $(NAME) $(USEPWD) +endif ######################################## #