Allow fixfiles to specify -v, so they can get verbosity rather then progress.

- Fix load_file Makefile to use SBINDIR rather then real OS.
- Fix man pages in setfiles and restorecon to reflect what happens when you relabel the entire OS.
This commit is contained in:
rhatdan 2012-09-17 14:56:05 -04:00
parent 6e9d4c92ea
commit 2d7c6d02f4
2 changed files with 127 additions and 2 deletions

View File

@ -638,7 +638,7 @@ index 8055a9e..dccb5f1 100644
type TEMPLATETYPE_spool_t;""" type TEMPLATETYPE_spool_t;"""
diff --git a/policycoreutils/load_policy/Makefile b/policycoreutils/load_policy/Makefile diff --git a/policycoreutils/load_policy/Makefile b/policycoreutils/load_policy/Makefile
index 5da2e0d..161abfc 100644 index 5da2e0d..7c5bab0 100644
--- a/policycoreutils/load_policy/Makefile --- a/policycoreutils/load_policy/Makefile
+++ b/policycoreutils/load_policy/Makefile +++ b/policycoreutils/load_policy/Makefile
@@ -19,7 +19,7 @@ install: all @@ -19,7 +19,7 @@ install: all
@ -646,10 +646,103 @@ index 5da2e0d..161abfc 100644
install -m 644 load_policy.8 $(MANDIR)/man8/ install -m 644 load_policy.8 $(MANDIR)/man8/
-mkdir -p $(USRSBINDIR) -mkdir -p $(USRSBINDIR)
- -ln -sf /sbin/load_policy $(USRSBINDIR)/load_policy - -ln -sf /sbin/load_policy $(USRSBINDIR)/load_policy
+ -ln -s /sbin/load_policy $(USRSBINDIR)/load_policy 2> /dev/null + -ln -sf $(SBINDIR)/load_policy $(USRSBINDIR)/load_policy
clean: clean:
-rm -f $(TARGETS) *.o -rm -f $(TARGETS) *.o
diff --git a/policycoreutils/scripts/fixfiles b/policycoreutils/scripts/fixfiles
index 989b1ae..19a4ff0 100755
--- a/policycoreutils/scripts/fixfiles
+++ b/policycoreutils/scripts/fixfiles
@@ -114,6 +114,7 @@ exclude_dirs() {
# Set global Variables
#
fullFlag=0
+VERBOSE="-p"
FORCEFLAG=""
DIRS=""
RPMILES=""
@@ -176,7 +177,7 @@ if [ -f ${PREFC} -a -x /usr/bin/diff ]; then
esac; \
fi; \
done | \
- ${RESTORECON} -i -f - -R -p `exclude_dirs`; \
+ ${RESTORECON} ${VERBOSE} -i -f - -R `exclude_dirs`; \
rm -f ${TEMPFILE} ${PREFCTEMPFILE}
fi
}
@@ -206,12 +207,12 @@ if [ ! -z "$PREFC" ]; then
fi
if [ ! -z "$RPMFILES" ]; then
for i in `echo "$RPMFILES" | sed 's/,/ /g'`; do
- rpmlist $i | ${RESTORECON} ${FORCEFLAG} $* -R -i -f - 2>&1 | cat >> $LOGFILE
+ rpmlist $i | ${RESTORECON} ${FORCEFLAG} ${VERBOSE} $* -R -i -f - 2>&1 | cat >> $LOGFILE
done
exit $?
fi
if [ ! -z "$FILEPATH" ]; then
- ${RESTORECON} ${FORCEFLAG} -R $* $FILEPATH 2>&1 | cat >> $LOGFILE
+ ${RESTORECON} ${FORCEFLAG} ${VERBOSE} -R $* $FILEPATH 2>&1 | cat >> $LOGFILE
return
fi
[ -x /usr/sbin/genhomedircon ] && /usr/sbin/genhomedircon
@@ -286,7 +287,7 @@ process() {
# Make sure they specified one of the three valid commands
#
case "$1" in
- restore) restore -p ;;
+ restore) restore;;
check) restore -n -v;;
verify) restore -n -o -;;
relabel) relabel;;
@@ -317,11 +318,14 @@ if [ $# = 0 ]; then
fi
# See how we were called.
-while getopts "C:FfR:l:" i; do
+while getopts "C:FfR:l:v" i; do
case "$i" in
f)
fullFlag=1
;;
+ v)
+ VERBOSE="-v"
+ ;;
R)
RPMFILES=$OPTARG
;;
diff --git a/policycoreutils/scripts/fixfiles.8 b/policycoreutils/scripts/fixfiles.8
index 0b4cbaa..9ab7334 100644
--- a/policycoreutils/scripts/fixfiles.8
+++ b/policycoreutils/scripts/fixfiles.8
@@ -5,13 +5,13 @@ fixfiles \- fix file SELinux security contexts.
.SH "SYNOPSIS"
.B fixfiles
-.I [-F] [-l logfile ] { check | restore|[-f] relabel | verify } [[dir/file] ... ]
+.I [-v] [-F] [-l logfile ] { check | restore|[-f] relabel | verify } [[dir/file] ... ]
.B fixfiles
-.I [-F] [ -R rpmpackagename[,rpmpackagename...] ] [-l logfile ] { check | restore | verify }
+.I [-v] [-F] [ -R rpmpackagename[,rpmpackagename...] ] [-l logfile ] { check | restore | verify }
.B fixfiles
-.I [ -C PREVIOUS_FILECONTEXT ] [-l logfile ] { check | restore | verify }
+.I [-v] [ -C PREVIOUS_FILECONTEXT ] [-l logfile ] { check | restore | verify }
.B fixfiles
.I onboot
@@ -54,6 +54,10 @@ Use the rpm database to discover all files within the specified packages and res
.B -C PREVIOUS_FILECONTEXT
Run a diff on the PREVIOUS_FILECONTEXT file to the currently installed one, and restore the context of all affected files.
+.TP
+.B -v
+Modify verbosity from progess to verbose. (Run restorecon with -v instead of -p)
+
.SH "ARGUMENTS"
One of:
.TP
diff --git a/policycoreutils/scripts/genhomedircon b/policycoreutils/scripts/genhomedircon diff --git a/policycoreutils/scripts/genhomedircon b/policycoreutils/scripts/genhomedircon
new file mode 100644 new file mode 100644
index 0000000..58b19cd index 0000000..58b19cd
@ -1032,6 +1125,33 @@ index ac27222..57ae46a 100644
+int exclude_non_seclabel_mounts(); +int exclude_non_seclabel_mounts();
#endif #endif
diff --git a/policycoreutils/setfiles/restorecon.8 b/policycoreutils/setfiles/restorecon.8
index ffbb9d1..91d02bd 100644
--- a/policycoreutils/setfiles/restorecon.8
+++ b/policycoreutils/setfiles/restorecon.8
@@ -55,7 +55,8 @@ don't change any file labels (passive check).
save list of files with incorrect context in outfilename.
.TP
.B \-p
-show progress by printing * every STAR_COUNT files.
+show progress by printing * every STAR_COUNT files. (If you relabel the entire OS, this will show you the percentage complete.)
+
.TP
.B \-R, \-r
change files and directories file labels recursively (descend directories).
diff --git a/policycoreutils/setfiles/setfiles.8 b/policycoreutils/setfiles/setfiles.8
index 7ff54f9..89d2a49 100644
--- a/policycoreutils/setfiles/setfiles.8
+++ b/policycoreutils/setfiles/setfiles.8
@@ -60,7 +60,7 @@ don't change any file labels (passive check).
save list of files with incorrect context in filename.
.TP
.B \-p
-show progress by printing * every STAR_COUNT files.
+show progress by printing * every STAR_COUNT files. (If you relabel the entire OS, this will show you the percentage complete.)
.TP
.B \-q
suppress non-error output.
diff --git a/policycoreutils/setfiles/setfiles.c b/policycoreutils/setfiles/setfiles.c diff --git a/policycoreutils/setfiles/setfiles.c b/policycoreutils/setfiles/setfiles.c
index ca24003..b11e49f 100644 index ca24003..b11e49f 100644
--- a/policycoreutils/setfiles/setfiles.c --- a/policycoreutils/setfiles/setfiles.c

View File

@ -332,6 +332,11 @@ The policycoreutils-restorecond package contains the restorecond service.
%{_bindir}/systemctl try-restart restorecond.service >/dev/null 2>&1 || : %{_bindir}/systemctl try-restart restorecond.service >/dev/null 2>&1 || :
%changelog %changelog
* Mon Sep 16 2012 Dan Walsh <dwalsh@redhat.com> - 2.1.12-3
- Allow fixfiles to specify -v, so they can get verbosity rather then progress.
- Fix load_file Makefile to use SBINDIR rather then real OS.
- Fix man pages in setfiles and restorecon to reflect what happens when you relabel the entire OS.
* Mon Sep 16 2012 Dan Walsh <dwalsh@redhat.com> - 2.1.12-2 * Mon Sep 16 2012 Dan Walsh <dwalsh@redhat.com> - 2.1.12-2
- Use systemd post install scriptlets - Use systemd post install scriptlets