Hi,

I was playing with file flags in /tmp, after reboot I saw
that /etc/rc cannot `rm' files with flags.

OK, my stupidity to keep those files but maybe following patch
to /etc/rc could be useful (my sed kungfu is not nice but using
awk I got quoting trouble).

jirib

Index: rc
===================================================================
RCS file: /cvs/src/etc/rc,v
retrieving revision 1.345
diff -u -p -r1.345 rc
--- rc  8 Nov 2010 19:44:36 -0000       1.345
+++ rc  4 Dec 2010 11:32:46 -0000
@@ -542,10 +542,15 @@ echo clearing /tmp
 
 # prune quickly with one rm, then use find to clean up /tmp/[lq]*
 # (not needed with mfs /tmp, but doesn't hurt there...)
-(cd /tmp && rm -rf [a-km-pr-zA-Z]*)
+(cd /tmp && rm -rf [a-km-pr-zA-Z]* 2>/dev/null)
 (cd /tmp &&
-    find . ! -name . ! -name lost+found ! -name quota.user \
-       ! -name quota.group -execdir rm -rf -- {} \; -type d -prune)
+    find . ! -name . ! -name lost+found ! -name quota.user ! -name quota.group 
\
+       -execdir sh -c 'i="{}"
+       flag="`ls -ldo $i | sed "s/\([^ ]*\)\  \([^ ]*\)\ \([^ ]*\)\  \([^ 
]*\)\  \([^ ]*\)\(.*\)/\5/"`"
+       if [ X"$flag" != X"-" ]; then
+       chflags -R nosappnd,noschg,nouappnd,nouchg $i
+       fi
+    rm -rf -- $i' \; -type d -prune)
 
 # create Unix sockets directories for X if needed and make sure they have
 # correct permissions

Reply via email to