Date: Sat, 22 Jun 2002 18:22:27 -0500 From: Bob Willcox <bob@immure.com> To: freebsd-current@freebsd.org Subject: locate.mklocatedb requires perl which may not be installed Message-ID: <20020622232227.GA50787@luke.immure.com>
next in thread | raw e-mail | index | archive | help
Hi,
I just installed a system today using the 5.0-CURRENT-20020621-JPSNAP.iso
CDROM and noticed that when I attempted to run /etc/periodic/weekly/310.locate
so that I could use locate to find some files that it spewed out:
Perl is not installed, try 'pkg_add -r perl'
Rather than simply installing perl (I'll get to that later)
I decided to track down what was calling it. Turns out that
/usr/libexec/locate.mklocatedb was the culprit. I then modified
locate.mklocatedb to use awk rather than perl. Here's the diff:
--- locate.mklocatedb.orig Thu Jun 20 17:07:43 2002
+++ locate.mklocatedb Sat Jun 22 18:09:03 2002
@@ -76,14 +76,15 @@
$code $bigrams > $filelist || exit 1
locate -d $filelist / | $bigram | $sort -nr | head -128 |
- perl -ne '/^\s*[0-9]+\s(..)$/ && print $1 || exit 1' > $bigrams || exit 1
+ awk '{if (/^[ ]*[0-9]+[ ]+..$/) {printf("%s",$2)} else {exit 1}}' > $bigrams
+ || exit 1
locate -d $filelist / | $code $bigrams || exit 1
exit
else
if $sortcmd $sortopt > $filelist; then
$bigram < $filelist | $sort -nr |
- perl -ne '/^\s*[0-9]+\s(..)$/ && print $1 || exit 1' > $bigrams
+ awk '{if (/^[ ]*[0-9]+[ ]+..$/) {printf("%s",$2)} else {exit 1}}' > $bigrams
|| exit 1
$code $bigrams < $filelist || exit 1
else
This seems to be working for me. It could likely be improved upon by the
perl and/or awk some expert out there. (I'm actually more familiar with
awk than perl but I wouldn't claim that my awk translation is the most
efficient either.)
--
Bob Willcox If practice makes perfect, and nobody's perfect,
bob@vieo.com why practice?
Austin, TX
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020622232227.GA50787>
