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

Re: nifty scripts

Craig wrote:
> here's a slight improvement for you. wrap the dupdatedb script in a
> Makefile

> and the crontab entry becomes:
> 42 3    * * *   root    make -f /usr/lib/dlocate/Makefile

Actually, use this instead:

42 3    * * *   root    make -f /usr/lib/dlocate/Makefile &> /dev/null

so you don't get an email every day.

I was actually working on a variation of the same idea -- everytime
somebody runs dlocate - it would call a setuid or setgid program which
would stat /var/lib/dpkg/status, and if that is changed, stat all the
/var/lib/dpkg/info/*.list files to see what was changed.  If any of them
had, it would add the files for them to another file or database which
would be used in the subsequent search in addition to the main database.
This would enable quick rebuilds.

But this idea seemed like an awful lot of work (plus an additional
security consideration) and would only be a second or two faster than
using the dlocate.grep method.  (Actually, the dlocate method could
probably check the timestamps -- and if they've changed, use the
dlocate.grep method instead)

> > I've got a few other quickie scripts that other people might find
> > helpful.  Does anyone else have some useful little scripts like this
> > that they use all the time but they aren't really big enough to package?
> i've written some stuff using sgrep which makes it easy to extract info
> from the /var/lib/dpkg/{status,available} or from a Packages file. e.g.
> find all packages which depend on another package.

Cool, that looks quite useful.  I wasn't aware that sgrep had those
macro definitions.  Thanks.

Here's 2 more little perl snippets I use quite often too:

-- cut here -- /usr/local/bin/debdesc
# By Jim Pick <jim@jimpick.com>, GPL'd of course
perl -000ne "print \"\$_\n\"
        if /Package:\s*$1\s/im" /var/lib/dpkg/available | less -i
-- cut here -- /usr/local/bin/debdescall
# By Jim Pick <jim@jimpick.com>, GPL'd of course
perl -000ne "print \"\$_\n\"
        if /$1/im" /var/lib/dpkg/available | less -i
-- cut here -- (end)

I use "debdesc <packagename>" to quickly display the package info
from the available file.

I use "debdescall <keyword>" to show all the packages which have that
keyword in their available file entries.

They're not much, but I find them to be real timesavers.

I really enjoy dpkg's "feature" of storing it's database using easily
parseable text files.  


 - Jim

Attachment: pgpBTvvtSgI9C.pgp
Description: PGP signature

Reply to: