[Pkg-sysvinit-devel] Bug#272066: Not delete symlinks to directories in /var/run/ ?

Andreas Metzler ametzler at downhill.at.eu.org
Tue Nov 22 18:54:06 UTC 2005


Thomas Hood wrote:
[...]
> Cameron Hutchison wrote to #272066:
>> This should do it. It uses the -xtype find(1) predicate. I'm not sure if
>> that's GNU only and if so, whether it is allowed in an initscript.

It is probably GNU-only (it is not POSIX and not even FreeBSD's finds
implements it), but that is no problem afaik.

>> --- /etc/init.d/bootclean.sh  2005-01-05 10:27:40.000000000 +1100
>> +++ /tmp/bootclean.sh 2005-11-22 09:27:46.105703939 +1100
>> @@ -90,7 +90,7 @@

>>       [ "$VERBOSE" != no ] && echo -n " /var/run"
>>       ( cd /var/run && \
>> -             find . ! -type d ! -name utmp ! -name innd.pid \
>> +             find . ! -type d ! -xtype d ! -name utmp ! -name innd.pid \
>>               -exec rm -f -- {} \; )
>>       rm -f /var/run/.clean
>>       set -o noclobber


> "! -type d" matches everything (including symbolic links) except directories.
> "! -xtype d" in the absence of "-L" matches everything except directories
> and symbolic links to directories.  Thus IIUC the latter eliminates the need
> for the former.

I think you are right.
              cu andreas
-- 
The 'Galactic Cleaning' policy undertaken by Emperor Zhark is a personal
vision of the emperor's, and its inclusion in this work does not constitute
tacit approval by the author or the publisher for any such projects,
howsoever undertaken.                                (c) Jasper Ffforde




More information about the Pkg-sysvinit-devel mailing list