tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Adding find_core_ignore_paths to daily



Hi,

As the daily script takes houres on my cobalt Qube2 looking for cores in backup directories, I pulled over
code from security to introduce find_core_ignore_paths.

Should I formalize a PR ?
Should the code be somehow factorized in rc.subr ?
Someone wants to commit the change ?


Regards,

Rémi Zara

--- daily.orig  2008-09-22 22:04:16.000000000 +0200
+++ daily       2008-09-22 22:14:48.000000000 +0200
@@ -79,11 +79,28 @@
 TMP2=daily2.$$

 if checkyesno find_core; then
- # Turn "foo !bar bax" into "-fstype foo -o ! -fstype bar -o - fstype bax"
-       ignfstypes=`echo $find_core_ignore_fstypes | \
- sed -e's/\(!*\)\([^[:space:]]\{1,\}\)/-o \1 -fstype \2/ g' \
-                   -e's/^-o //'`
-       find / \( $ignfstypes \) -prune -o \
+       # Convert find_core_ignore_fstypes="foo !bar bax"
+       #    into "-fstype foo -o ! -fstype bar -o -fstype bax"
+       # and find_core_ignore_paths="/foo !/bar /bax"
+       #    into " -path /foo -o ! -path /bar -o -path /bax"
+       #
+       ignexpr=$(\
+               echo $find_core_ignore_fstypes | \
+ sed -e's/\(!*\)\([^[:space:]]\{1,\}\)/-o \1 - fstype \2/g' ; \
+               echo $find_core_ignore_paths | \
+ sed -e's/\(!*\)\([^[:space:]]\{1,\}\)/-o \1 - path \2/g' \
+       )
+
+       # Massage the expression into ( $ignexpr ) -a -prune -o
+       if [ -n "${ignexpr}" ]; then
+               ignexpr=$(\
+                       echo $ignexpr | \
+                               sed -e 's/^-o /( /' \
+                                   -e 's/$/ ) -a -prune -o/' \
+               )
+       fi
+
+       find / $ignexpr \
                -name 'lost+found' -prune -o \
\( -name '*.core' -o -name 'core' \) -type f -print > $TMP
 #              \( -name '[#,]*' -o -name '.#*' -o -name a.out \

Attachment: smime.p7s
Description: S/MIME cryptographic signature



Home | Main Index | Thread Index | Old Index