bug-gnu-utils
[Top][All Lists]
Advanced

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

updatedb frontend works well with updatedb.conf ???


From: Le Saint Yannick
Subject: updatedb frontend works well with updatedb.conf ???
Date: Sat, 05 Jan 2002 02:02:00 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.5) Gecko/20011230


I have expererienced problems using updated.conf to configure updatedb/slocate.
It seemed to me like updatedb did not give a shit to VERBOSE="YES" entry.

So, as I thought than slocate does a very good job by himself without parsing /etc/updatedb.conf file, I decided to parse this file myself in updatedb script and run
slocate consequently.

 I hope I have given some improvements to updatedb :
   - updatedb parses /etc/updatedb.conf and run slocate consequently.
- any argument given to updatedb will go through himself directly to slocate, thus allowing /etc/updatedb.conf overriding and some other arguments (-i, -n, -r, -d, -h, -V). So I can type "updatedb -v" and see a really verbose output
      (great isn't it ;-) ).
- parsing of /etc/updatedb.conf is not done if it is impossible (file does not exists, does not have sifficient permissions, /etc/updatedb.conf is not a file).

You may find some of them really useful and get them into findutils project ?...

Oh, by the way, are "proc" directory and filesystem really bad "slocating" ???
(they were in PRUNEPATHS and PRUNEFS on my computer).


Here is the script (updatedb), you will also find it as an attached piece, so you can
read it the way you like it.


 That's it, thanks :-)


#! /bin/bash
# (c) MandrakeSoft.
# Chmouel Boudjnah <address@hidden>
#
# Modified 20010109 by Francis Galiegue <address@hidden>
#
# Fixes by address@hidden

# No need to source /etc/updatedb.conf. Use the -c option, that's what it's
# for...

# yannick : you would more likely see this
# source /etc/updatedb.conf
# . /etc/updatedb.conf
# yannick : check configuration file
test -f /etc/updatedb.conf && test -r /etc/updatedb.conf && . 
/etc/updatedb.conf;

# yannick : /etc/updatedb.conf does not seem to work
# so well (especially "-v" option passing)
# /usr/bin/slocate -c -u -l"$SECURITY"
# OK, let's try something else, I'll make command
# line using /etc/updatedb.conf values
# /usr/bin/slocate -c -u -l"$SECURITY" "$@"

# yannick : "-c" sould not be useful, now we read configuration
# file by our own
cmd="/usr/bin/slocate -c";


cmd="$cmd -U \"${FROM:-"/"}\"";

test "${PRUNEPATHS:-}" != "" &&
        cmd="$cmd -e \"$PRUNEPATHS\"";

test "${PRUNEFS:-}" != "" &&
        cmd="$cmd -e \"$PRUNEFS\"";

test "${SECURITY:-}" != "" &&
        cmd="$cmd -l \"$SECURITY\"";

# "-i" flag can only go in "$@"

test "${QUIET:-}" = "YES"  -o "${QUIET:-}" = "yes" &&
        cmd="$cmd -q";

# "-n" and "-r" options go in "$@"

test "${DATABASE:-}" != "" &&
        cmd="$cmd -o \"$DATABASE\"";

# "-d" and "-h" options can only go in "$@"

test "${VERBOSE:-}" = "YES" -o "${VERBOSE:-}" = "yes" &&
        cmd="$cmd -v";

# "-V" flag goes in "$@";


# so, we can finally execute our so hardly constructed command
# echo running $cmd "$@"; # used for debugging
eval $cmd "$@" || exit 1;

# OK, everything is fine
exit 0;


#! /bin/bash
# (c) MandrakeSoft.
# Chmouel Boudjnah <address@hidden>
#
# Modified 20010109 by Francis Galiegue <address@hidden>
#
# Fixes by address@hidden

# No need to source /etc/updatedb.conf. Use the -c option, that's what it's
# for...

# yannick : you would more likely see this
# source /etc/updatedb.conf
# . /etc/updatedb.conf
# yannick : check configuration file
test -f /etc/updatedb.conf && test -r /etc/updatedb.conf && . 
/etc/updatedb.conf;

# yannick : /etc/updatedb.conf does not seem to work
# so well (especially "-v" option passing)
# /usr/bin/slocate -c -u -l"$SECURITY"
# OK, let's try something else, I'll make command
# line using /etc/updatedb.conf values
# /usr/bin/slocate -c -u -l"$SECURITY" "$@"

# yannick : "-c" sould not be useful, now we read configuration
# file by our own
cmd="/usr/bin/slocate -c";


cmd="$cmd -U \"${FROM:-"/"}\"";

test "${PRUNEPATHS:-}" != "" &&
        cmd="$cmd -e \"$PRUNEPATHS\"";

test "${PRUNEFS:-}" != "" &&
        cmd="$cmd -e \"$PRUNEFS\"";

test "${SECURITY:-}" != "" &&
        cmd="$cmd -l \"$SECURITY\"";

# "-i" flag can only go in "$@"

test "${QUIET:-}" = "YES"  -o "${QUIET:-}" = "yes" &&
        cmd="$cmd -q";

# "-n" and "-r" options go in "$@"

test "${DATABASE:-}" != "" &&
        cmd="$cmd -o \"$DATABASE\"";

# "-d" and "-h" options can only go in "$@"

test "${VERBOSE:-}" = "YES" -o "${VERBOSE:-}" = "yes" &&
        cmd="$cmd -v";

# "-V" flag goes in "$@";


# so, we can finally execute our so hardly constructed command
# echo running $cmd "$@"; # used for debugging
eval $cmd "$@" || exit 1;

# OK, everything is fine
exit 0;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]