cleanup fixfiles so setfiles -l if no log file specified
This commit is contained in:
parent
c7495d8641
commit
34ca4fe9ed
@ -1,15 +1,108 @@
|
|||||||
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/Makefile policycoreutils-1.17.6/scripts/Makefile
|
--- policycoreutils-1.17.6/scripts/fixfiles.rhat 2004-10-06 09:47:47.000000000 -0400
|
||||||
--- nsapolicycoreutils/scripts/Makefile 2004-09-10 11:25:57.000000000 -0400
|
+++ policycoreutils-1.17.6/scripts/fixfiles 2004-10-12 11:14:29.468471753 -0400
|
||||||
+++ policycoreutils-1.17.6/scripts/Makefile 2004-10-06 09:56:23.630849143 -0400
|
@@ -31,6 +31,8 @@
|
||||||
@@ -12,7 +12,7 @@
|
outfileFlag=0
|
||||||
-mkdir -p $(BINDIR)
|
OUTFILES=""
|
||||||
install -m 755 $(TARGETS) $(BINDIR)
|
logfileFlag=0
|
||||||
install -m 755 fixfiles $(DESTDIR)/sbin
|
+LOGFILE=/dev/null
|
||||||
- install -D -m 755 fixfiles.cron $(DESTDIR)/etc/cron.daily/fixfiles.cron
|
+SYSLOGFLAG="-l"
|
||||||
+ install -D -m 755 fixfiles.cron $(DESTDIR)/etc/cron.weekly/fixfiles.cron
|
SETFILES=/usr/sbin/setfiles
|
||||||
-mkdir -p $(MANDIR)/man8
|
FILESYSTEMSRW=`mount | grep -v "context=" | egrep -v '\((|.*,)bind(,.*|)\)' | awk '/(ext[23]| xfs | reiserfs ).*\(rw/{print $3}';`
|
||||||
install -m 644 fixfiles.8.gz $(MANDIR)/man8/
|
FILESYSTEMSRO=`mount | grep -v "context=" | egrep -v '\((|.*,)bind(,.*|)\)' | awk '/(ext[23]| xfs | reiserfs ).*\(ro/{print $3}';`
|
||||||
|
@@ -44,50 +46,54 @@
|
||||||
|
FC=/etc/security/selinux/file_contexts
|
||||||
|
fi
|
||||||
|
|
||||||
|
+logit () {
|
||||||
|
+if [ $logfileFlag = 0 ]; then
|
||||||
|
+ logger -i $1
|
||||||
|
+else
|
||||||
|
+ echo $1 >> $LOGFILE
|
||||||
|
+fi
|
||||||
|
+}
|
||||||
|
checkLabels () {
|
||||||
|
-echo "logging to $LOGFILE"
|
||||||
|
if [ ! -z "$1" ]; then
|
||||||
|
for i in `echo $1 | sed 's/,/ /g'`; do
|
||||||
|
- rpm -q -l $i | restorecon ${OUTFILES} -n -v -f - 2>&1 > $LOGFILE
|
||||||
|
+ rpm -q -l $i | restorecon ${OUTFILES} -n -v -f - 2>&1 >> $LOGFILE
|
||||||
|
done
|
||||||
|
else
|
||||||
|
if [ ! -z "$FILESYSTEMSRO" ]; then
|
||||||
|
- echo "Warning: Skipping the following R/O filesystems:"
|
||||||
|
- echo "$FILESYSTEMSRO"
|
||||||
|
+ logit "Warning: Skipping the following R/O filesystems:"
|
||||||
|
+ logit "$FILESYSTEMSRO"
|
||||||
|
fi
|
||||||
|
- ${SETFILES} ${OUTFILES} -n -v ${FC} ${FILESYSTEMSRW} 2>&1 > $LOGFILE
|
||||||
|
+ ${SETFILES} ${OUTFILES} ${SYSLOGFLAG} -n -v ${FC} ${FILESYSTEMSRW} 2>&1 >> $LOGFILE
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
restoreLabels () {
|
||||||
|
-echo "logging to $LOGFILE"
|
||||||
|
if [ ! -z "$1" ]; then
|
||||||
|
for i in `echo $1 | sed 's/,/ /g'`; do
|
||||||
|
- rpm -q -l $i | restorecon ${OUTFILES} -v -f - 2>&1 > $LOGFILE
|
||||||
|
+ rpm -q -l $i | restorecon ${OUTFILES} -v -f - 2>&1 >> $LOGFILE
|
||||||
|
done
|
||||||
|
else
|
||||||
|
if [ ! -z "$FILESYSTEMSRO" ]; then
|
||||||
|
- echo "Warning: Skipping the following R/O filesystems:"
|
||||||
|
- echo "$FILESYSTEMSRO"
|
||||||
|
+ logit "Warning: Skipping the following R/O filesystems:"
|
||||||
|
+ logit "$FILESYSTEMSRO"
|
||||||
|
fi
|
||||||
|
- ${SETFILES} ${OUTFILES} -v ${FC} ${FILESYSTEMS} 2>&1 > $LOGFILE
|
||||||
|
+ ${SETFILES} ${OUTFILES} ${SYSLOGFLAG} -v ${FC} ${FILESYSTEMS} 2>&1 >> $LOGFILE
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
relabel() {
|
||||||
|
-echo "logging to $LOGFILE"
|
||||||
|
-echo "Cleaning out /tmp"
|
||||||
|
+logit "Cleaning out /tmp"
|
||||||
|
rm -rf /tmp/.??* /tmp/*
|
||||||
|
if [ ! -z "$1" ]; then
|
||||||
|
for i in `echo $1 | sed 's/,/ /g'`; do
|
||||||
|
- rpm -q -l $i | restorecon ${OUTFILES} -v -f - 2>&1 > $LOGFILE
|
||||||
|
+ rpm -q -l $i | restorecon ${OUTFILES} -v -f - 2>&1 >> $LOGFILE
|
||||||
|
done
|
||||||
|
else
|
||||||
|
if [ ! -z "$FILESYSTEMSRO" ]; then
|
||||||
|
- echo "Warning: Skipping the following R/O filesystems:"
|
||||||
|
- echo "$FILESYSTEMSRO"
|
||||||
|
+ logit "Warning: Skipping the following R/O filesystems:"
|
||||||
|
+ logit "$FILESYSTEMSRO"
|
||||||
|
fi
|
||||||
|
- ${SETFILES} ${OUTFILES} -v ${FC} ${FILESYSTEMS} 2>&1 > $LOGFILE
|
||||||
|
+ ${SETFILES} ${OUTFILES} ${SYSLOGFLAG} -v ${FC} ${FILESYSTEMS} 2>&1 >> $LOGFILE
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
relabelCheck() {
|
||||||
|
@@ -129,6 +135,8 @@
|
||||||
|
fi
|
||||||
|
if [ $logfileFlag = 2 ]; then
|
||||||
|
LOGFILE="$i"
|
||||||
|
+ echo > $LOGFILE
|
||||||
|
+ SYSLOGFLAG=""
|
||||||
|
logfileFlag=1
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
@@ -165,13 +173,6 @@
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
-if [ $logfileFlag = 0 ]; then
|
||||||
|
- LOGFILE=`mktemp /var/tmp/fixfiles.log.XXXXXXXXXX`
|
||||||
|
- if [ ! -w $LOGFILE ] ; then
|
||||||
|
- exit 1
|
||||||
|
- fi
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
if [ $checkFlag = 1 ]; then
|
||||||
|
checkLabels $rpmFiles
|
||||||
|
fi
|
||||||
--- policycoreutils-1.17.6/scripts/Makefile.rhat 2004-10-06 09:47:47.000000000 -0400
|
--- policycoreutils-1.17.6/scripts/Makefile.rhat 2004-10-06 09:47:47.000000000 -0400
|
||||||
+++ policycoreutils-1.17.6/scripts/Makefile 2004-10-06 09:56:23.000000000 -0400
|
+++ policycoreutils-1.17.6/scripts/Makefile 2004-10-06 09:56:23.000000000 -0400
|
||||||
@@ -12,7 +12,7 @@
|
@@ -12,7 +12,7 @@
|
||||||
|
Loading…
Reference in New Issue
Block a user