policycoreutils: fixfiles: fix logging about R/O filesystems

The LogReadOnly() call which warns the user about R/O filesystems, applies
to the `-B` mode (newer() function), and the `fixfiles check` mode
(no paths).

Make sure to print it for these modes, and these modes only.
This commit is contained in:
Alan Jenkins 2017-05-04 18:01:20 +01:00 committed by James Carter
parent 08df753962
commit 55f220122f

View File

@ -136,16 +136,27 @@ if [ -n $LOGFILE ]; then
echo $1 >> $LOGFILE
fi
}
#
# Log all Read Only file systems
#
LogReadOnly() {
if [ ! -z "$FILESYSTEMSRO" ]; then
logit "Warning: Skipping the following R/O filesystems:"
logit "$FILESYSTEMSRO"
fi
}
#
# Find files newer then the passed in date and fix the label
#
newer() {
DATE=$1
shift
LogReadOnly
for m in `echo $FILESYSTEMSRW`; do
find $m -mount -newermt $DATE -print0 2>/dev/null | ${RESTORECON} ${FORCEFLAG} ${VERBOSE} $* -i -0 -f -
done;
}
#
@ -192,15 +203,6 @@ if [ -f ${PREFC} -a -x /usr/bin/diff ]; then
rm -f ${TEMPFILE} ${PREFCTEMPFILE}
fi
}
#
# Log all Read Only file systems
#
LogReadOnly() {
if [ ! -z "$FILESYSTEMSRO" ]; then
logit "Warning: Skipping the following R/O filesystems:"
logit "$FILESYSTEMSRO"
fi
}
rpmlist() {
rpm -q --qf '[%{FILESTATES} %{FILENAMES}\n]' "$1" | grep '^0 ' | cut -f2- -d ' '
@ -224,9 +226,8 @@ if [ ! -z "$BOOTTIME" ]; then
exit $?
fi
[ -x /usr/sbin/genhomedircon ] && /usr/sbin/genhomedircon
LogReadOnly
#
exclude_dirs="`exclude_dirs_from_relabelling $OPTION`"
exclude_dirs="`exclude_dirs_from_relabelling`"
if [ ! -z "$RPMFILES" ]; then
for i in `echo "$RPMFILES" | sed 's/,/ /g'`; do
rpmlist $i | ${RESTORECON} $exclude_dirs ${FORCEFLAG} ${VERBOSE} $* -R -i -f - >>$LOGFILE 2>&1
@ -238,6 +239,7 @@ if [ ! -z "$FILEPATH" ]; then
return
fi
if [ -n "${FILESYSTEMSRW}" ]; then
LogReadOnly
echo "${OPTION}ing `echo ${FILESYSTEMSRW}`"
${SETFILES} ${VERBOSE} $exclude_dirs -q ${FORCEFLAG} $* ${FC} ${FILESYSTEMSRW} >>$LOGFILE 2>&1
else