Daily Archives: July 8, 2008
If you’re looking for how to get slocate on opensolaris working, skip to the bottom of the article for step-by-step instructions.
Getting up to speed on opensolaris is a gradual process. There are tools you take for granted in Linux, that suddenly aren’t there, and it can be quite frustrating trying to figure out what package they’re in. Even tools that don’t seem to exist!
One of the most important is locate, or slocate (I’m not fussy – either will do nicely). After a frustrating hunt for the package containing it, I turned to google, which seems to tell me there is no (s)locate package! So I’ll have to build from source.
Right, google takes me to slocate.trakker.ca. Download it, check the signature. Hmm, no chain of trust, but a bit more googling finds the author is a Debian developer, and debian.org vouches for him. So the chance of it being a trojan is pretty much negligible. OK, go ahead.
Ouch! There’s no configure, only a Makefile. If I just try to make, it complains of missing header files. Where to find them, or am I onto a loser?
A bit more googling finds me this article, which recommends installing slocate version 2.7 which comes with a configure script. So I tried, only to find that doesn’t work either. Too many missing pieces, and silly things like a hardwired autoconf-1.4 (OpenSolaris offers 1.9 and 1.10). Fixing that just launches me into the next problem. Bah, humbug.
But wait: there’s also an autogen.sh. Running that is a different story: it generates a Makefile that Just Works! Right, now I have the binary. make install still fails, but make -n install tells me what I need to do (and it’s not much). So I can do that by hand without pain.
Now updatedb runs just fine, whereupon I have a working locate. Eureka!
- Ensure you have a GNU build environment. For example, pfexec pkg install gcc-dev will give you that, if you don’t already have it.
- Download slocate 2.7 from slocate.trakker.ca, and verify the PGP signature.
- Unpack slocate-2.7 and cd to it.
- Run autogen.sh
- make -n install
- Follow the steps shown, but use cp rather than install, since the latter is incompatible with the usage in the Makefile.
- Optionally, create /etc/updatedb.conf
- Run updatedb, and try a locate (you may want to add /usr/local/bin to your PATH if it’s not there already).
- Finally set up the cron job to taste. I find a weekly updatedb works well for me, but YMMV.