All of lore.kernel.org
 help / color / mirror / Atom feed
* Fixfiles using new setfiles/restorecon simplification
@ 2010-02-24 20:46 Daniel J Walsh
  2010-02-26  1:41 ` Joshua Brindle
  2010-02-26 17:56 ` Stephen Smalley
  0 siblings, 2 replies; 20+ messages in thread
From: Daniel J Walsh @ 2010-02-24 20:46 UTC (permalink / raw)
  To: SELinux

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: fixfiles.patch --]
[-- Type: text/plain, Size: 2298 bytes --]

diff --git a/policycoreutils/scripts/fixfiles b/policycoreutils/scripts/fixfiles
index ae519fc..135835f 100755
--- a/policycoreutils/scripts/fixfiles
+++ b/policycoreutils/scripts/fixfiles
@@ -35,8 +35,8 @@ SYSLOGFLAG="-l"
 LOGGER=/usr/sbin/logger
 SETFILES=/sbin/setfiles
 RESTORECON=/sbin/restorecon
-FILESYSTEMSRW=`mount | grep -v "context=" | egrep -v '\((|.*,)bind(,.*|)\)' | awk '/(ext[234]| ext4dev | gfs2 | xfs | jfs | btrfs ).*\(rw/{print $3}';`
-FILESYSTEMSRO=`mount | grep -v "context=" | egrep -v '\((|.*,)bind(,.*|)\)' | awk '/(ext[234]| ext4dev | gfs2 | xfs | jfs | btrfs ).*\(ro/{print $3}';`
+FILESYSTEMSRW=`grep rw,seclabel /proc/self/mounts | awk '{ print $2 }'`
+FILESYSTEMSRO=`grep -v 'rw\|seclabel' /proc/self/mounts | awk '{ print $2 }'`
 FILESYSTEMS="$FILESYSTEMSRW $FILESYSTEMSRO"
 SELINUXTYPE="targeted"
 if [ -e /etc/selinux/config ]; then
@@ -87,11 +87,7 @@ if [ -f ${PREFC} -a -x /usr/bin/diff ]; then
                   esac; \
                fi; \
             done | \
-	while read pattern ; do sh -c "find $pattern \
-		      ! \( -fstype ext2 -o -fstype ext3 -o -fstype ext4 -o -fstype ext4dev  -o -fstype gfs2 -o -fstype jfs -o -fstype xfs -o -fstype btrfs \) -prune  -o \
-		      \( -wholename /home -o -wholename /root -o -wholename /tmp -wholename /dev \) -prune -o -print0"; \
-		      done 2> /dev/null | \
-	 ${RESTORECON} $* -0 -f - 
+		      ${RESTORECON} -f - -R -p  -e /home -e /tmp -r /dev; \
 	rm -f ${TEMPFILE} ${PREFCTEMPFILE}
 fi
 }
@@ -126,13 +122,7 @@ if [ ! -z "$RPMFILES" ]; then
     exit $?
 fi
 if [ ! -z "$FILEPATH" ]; then
-    if [ -x /usr/bin/find ]; then
-	/usr/bin/find "$FILEPATH" \
-	    ! \( -fstype ext2 -o -fstype ext3 -o -fstype ext4 -o -fstype ext4dev -o -fstype gfs2 -o -fstype jfs -o -fstype xfs -o -fstype btrfs \) -prune  -o -print0 | \
-	    ${RESTORECON} ${FORCEFLAG} $* -0 -f - 2>&1 >> $LOGFILE
-    else
-	${RESTORECON} ${FORCEFLAG} -R $* $FILEPATH 2>&1 >> $LOGFILE
-    fi
+    ${RESTORECON} ${FORCEFLAG} -R $* $FILEPATH 2>&1 >> $LOGFILE
     return
 fi
 [ -x /usr/sbin/genhomedircon ] && /usr/sbin/genhomedircon
@@ -146,7 +136,7 @@ exit $?
 
 fullrelabel() {
     logit "Cleaning out /tmp"
-    find /tmp/ -mindepth 1 -print0 | xargs -0 /bin/rm -f
+    find /tmp/ -mindepth 1 -delete
     LogReadOnly
     restore
 }

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2010-02-26 21:14 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-24 20:46 Fixfiles using new setfiles/restorecon simplification Daniel J Walsh
2010-02-26  1:41 ` Joshua Brindle
2010-02-26 12:56   ` Stephen Smalley
2010-02-26 13:41   ` Daniel J Walsh
2010-02-26 14:10     ` Stephen Smalley
2010-02-26 14:23       ` Daniel J Walsh
2010-02-26 14:36         ` Stephen Smalley
2010-02-26 18:12           ` Daniel J Walsh
2010-02-26 20:16             ` Stephen Smalley
2010-02-26 20:25               ` Daniel J Walsh
2010-02-26 20:33                 ` Stephen Smalley
2010-02-26 20:47                 ` Stephen Smalley
2010-02-26 20:52                   ` Daniel J Walsh
2010-02-26 20:57                     ` Stephen Smalley
2010-02-26 21:04                       ` Daniel J Walsh
2010-02-26 17:56 ` Stephen Smalley
2010-02-26 18:36   ` Daniel J Walsh
2010-02-26 18:59   ` Daniel J Walsh
2010-02-26 20:49     ` Stephen Smalley
2010-02-26 21:14       ` Daniel J Walsh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.