* Mon Dec 29 2004 Dan Walsh <dwalsh@redhat.com> 1.19.2-2

- Fix fixfiles handling of rpm
This commit is contained in:
Daniel J Walsh 2005-01-03 18:32:44 +00:00
parent 38d8cfc55c
commit 3673618fbf
2 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,53 @@
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/fixfiles policycoreutils-1.19.2/scripts/fixfiles
--- nsapolicycoreutils/scripts/fixfiles 2004-10-26 11:15:41.000000000 -0400
+++ policycoreutils-1.19.2/scripts/fixfiles 2005-01-03 13:30:04.708085304 -0500
@@ -53,10 +53,13 @@
echo $1 >> $LOGFILE
fi
}
+rpmlist() {
+rpm -q --qf '[%{FILESTATES} %{FILENAMES}\n]' "$1" | grep '^0 ' | cut -f2- -d ' '
+}
checkLabels () {
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
+ rpmlist $i | restorecon ${OUTFILES} -R -n -v -f - 2>&1 >> $LOGFILE
done
else
if [ ! -z "$FILESYSTEMSRO" ]; then
@@ -70,7 +73,7 @@
restoreLabels () {
if [ ! -z "$1" ]; then
for i in `echo $1 | sed 's/,/ /g'`; do
- rpm -q -l $i | restorecon ${OUTFILES} -v -f - 2>&1 >> $LOGFILE
+ rpmlist $i | restorecon ${OUTFILES} -R -v -f - 2>&1 >> $LOGFILE
done
else
if [ ! -z "$FILESYSTEMSRO" ]; then
@@ -82,13 +85,11 @@
}
relabel() {
-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
- done
+ restoreLabels $1
else
+ logit "Cleaning out /tmp"
+ rm -rf /tmp/.??* /tmp/*
if [ ! -z "$FILESYSTEMSRO" ]; then
logit "Warning: Skipping the following R/O filesystems:"
logit "$FILESYSTEMSRO"
@@ -180,7 +181,7 @@
restoreLabels $rpmFiles
fi
if [ $relabelFlag = 1 ]; then
- if [ $fullFlag = 1 ]; then
+ if [ $fullFlag = 1 -o ! -z "$rpmFiles" ]; then
relabel $rpmFiles
else
relabelCheck $rpmFiles

View File

@ -1,10 +1,11 @@
Summary: SELinux policy core utilities.
Name: policycoreutils
Version: 1.19.2
Release: 1
Release: 2
License: GPL
Group: System Environment/Base
Source: http://www.nsa.gov/selinux/archives/policycoreutils-%{version}.tgz
Patch: policycoreutils-rhat.patch
Prefix: %{_prefix}
BuildRequires: libselinux-devel >= 1.15.3 pam-devel libsepol-devel >= 1.1.1
@ -31,6 +32,7 @@ context.
%prep
%setup -q
%patch -p1 -b .rhat
%build
make CFLAGS="%{optflags}" all
@ -74,6 +76,9 @@ rm -rf ${RPM_BUILD_ROOT}
%changelog
* Mon Dec 29 2004 Dan Walsh <dwalsh@redhat.com> 1.19.2-2
- Fix fixfiles handling of rpm
* Mon Dec 29 2004 Dan Walsh <dwalsh@redhat.com> 1.19.2-1
- Update to latest from NSA
* Changed restorecon to ignore ENOENT errors from matchpathcon.