7ac30031a8
- Fix fixfiles handling of rpm - Fix restorecon to not warn on symlinks unless -v -v - Fix output of verbose to show old context as well as new context
87 lines
2.8 KiB
Diff
87 lines
2.8 KiB
Diff
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/restorecon/restorecon.c policycoreutils-1.19.2/restorecon/restorecon.c
|
|
--- nsapolicycoreutils/restorecon/restorecon.c 2004-12-29 12:18:11.000000000 -0500
|
|
+++ policycoreutils-1.19.2/restorecon/restorecon.c 2005-01-03 14:14:12.256118904 -0500
|
|
@@ -68,7 +68,8 @@
|
|
return 1;
|
|
}
|
|
if (S_ISLNK(st.st_mode)) {
|
|
- fprintf(stderr,"Warning! %s refers to a symbolic link, not following last component.\n", filename);
|
|
+ if (verbose>1)
|
|
+ fprintf(stderr,"Warning! %s refers to a symbolic link, not following last component.\n", filename);
|
|
char *p = NULL, *file_sep;
|
|
char *tmp_path = strdup(filename);
|
|
if (!tmp_path) {
|
|
@@ -129,8 +130,8 @@
|
|
return 1;
|
|
} else
|
|
if (verbose)
|
|
- fprintf(stderr,"%s reset context %s->%s\n",
|
|
- progname, filename, scontext);
|
|
+ fprintf(stderr,"%s reset context %s:%s->%s\n",
|
|
+ progname, filename, prev_context, scontext);
|
|
}
|
|
if (retcontext >= 0)
|
|
freecon(prev_context);
|
|
@@ -198,7 +199,7 @@
|
|
}
|
|
break;
|
|
case 'v':
|
|
- verbose = 1;
|
|
+ verbose++;
|
|
break;
|
|
case 'f':
|
|
file = 1;
|
|
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.000000000 -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
|