policycoreutils/policycoreutils-rhat.patch
cvsdist 24ae558df4 auto-import changelog data from policycoreutils-1.13-2.src.rpm
* Tue May 25 2004 Dan Walsh <dwalsh@redhat.com> 1.13-2
- Change to use /etc/sysconfig/selinux to determine location of policy files
2004-09-09 10:34:58 +00:00

68 lines
1.9 KiB
Diff

--- policycoreutils-1.13/scripts/fixfiles.rhat 2004-05-21 14:26:51.000000000 -0400
+++ policycoreutils-1.13/scripts/fixfiles 2004-05-25 15:06:03.586866792 -0400
@@ -19,24 +19,42 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-FC=/etc/security/selinux/file_contexts
+SELINUXTYPE="targeted"
+. /etc/sysconfig/selinux
+FC=/etc/selinux/${SELINUXTYPE}/contexts/file_contexts
LOGFILE=`mktemp /var/tmp/fixfiles.XXXXXXXXXX` || exit 1
-echo "logging to $LOGFILE"
SETFILES=/usr/sbin/setfiles
FILESYSTEMS=`mount | grep -v "context=" | egrep -v '\((|.*,)bind(,.*|)\)' | awk '/(ext[23]| xfs).*rw/{print $3}';`
checkLabels () {
+echo "logging to $LOGFILE"
${SETFILES} -v -n ${FC} ${FILESYSTEMS} 2>&1 | tee $LOGFILE
}
restoreLabels () {
+echo "logging to $LOGFILE"
${SETFILES} -v ${FC} ${FILESYSTEMS} 2>&1 | tee $LOGFILE
}
relabel() {
+echo "logging to $LOGFILE"
echo "Cleaning out /tmp"
rm -rf /tmp/.??* /tmp/*
-${SETFILES} ${FC} ${FILESYSTEMS} 2>&1 | tee $LOGFILE
+${SETFILES} -v ${FC} ${FILESYSTEMS} 2>&1 | tee $LOGFILE
+}
+relabelCheck() {
+echo -n "
+Files in the /tmp directory may be labeled incorrectly, this command
+can remove all files in /tmp. If you choose to remove files from /tmp,
+a reboot will be required after completion.
+
+Do you wish to clean out the /tmp directory [N]? "
+read answer
+if [ "$answer" = y -o "$answer" = Y ]; then
+ relabel
+else
+ restoreLabels
+fi
+
}
# See how we were called.
@@ -48,10 +66,15 @@
restoreLabels
;;
relabel)
- relabel
+ relabelCheck
;;
+ -F)
+ if "$1" = "relabel"; then
+ relabel
+ fi
+ ;;
*)
- echo $"Usage: $0 {check|restore|relabel}"
+ echo $"Usage: $0 {check|restore|[-F] relabel}"
exit 1
esac
exit $?