Set TMPDIR to /tmp

Use the new find option -s for sorted output.
Remove the temp directory in trap.
This commit is contained in:
Wolfram Schneider 1998-11-29 14:46:35 +00:00
parent 12c38b04f1
commit 215a9c2799
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=41413

View File

@ -26,7 +26,7 @@
#
# updatedb - update locate database for local mounted filesystems
#
# $Id: updatedb.sh,v 1.10 1998/03/08 16:09:31 wosch Exp $
# $Id: updatedb.sh,v 1.11 1998/06/18 09:26:22 wosch Exp $
LOCATE_CONFIG="/etc/locate.rc"
if [ -f "$LOCATE_CONFIG" -a -r "$LOCATE_CONFIG" ]; then
@ -35,9 +35,8 @@ fi
# The directory containing locate subprograms
: ${LIBEXECDIR:=/usr/libexec}; export LIBEXECDIR
: ${TMPDIR:=/var/tmp}; export TMPDIR
if TMPDIR=`mktemp -d $TMPDIR/locateXXXXXX`; then :
else
: ${TMPDIR:=/tmp}; export TMPDIR
if ! TMPDIR=`mktemp -d $TMPDIR/locateXXXXXX`; then
exit 1
fi
@ -74,12 +73,12 @@ case X"$PRUNEPATHS" in
esac
tmp=$TMPDIR/_updatedb$$
trap 'rm -f $tmp' 0 1 2 3 5 10 15
trap 'rm -f $tmp; rmdir $TMPDIR' 0 1 2 3 5 10 15
# search locally
# echo $find $SEARCHPATHS $excludes -or -print && exit
if $find $SEARCHPATHS $excludes -or -print 2>/dev/null |
$mklocatedb > $tmp
if $find -s $SEARCHPATHS $excludes -or -print 2>/dev/null |
$mklocatedb -presort > $tmp
then
case X"`$find $tmp -size -257c -print`" in
X) cat $tmp > $FCODES;;
@ -87,5 +86,4 @@ then
exit 1
esac
fi
rm -f $tmp
rmdir $TMPDIR
echo $?