as bin not nobody to avoid NFS problems.
#!/bin/sh -
#
-# $OpenBSD: weekly,v 1.4 1996/12/18 04:32:57 millert Exp $
+# $OpenBSD: weekly,v 1.5 1997/01/03 23:33:50 millert Exp $
#
PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/libexec
if [ -f /var/db/locate.database ]; then
echo "Rebuilding locate database:"
chmod 644 /var/db/locate.database
- chown nobody.nobody /var/db/locate.database
- echo /usr/libexec/locate.updatedb | nice -5 su -m nobody 2>/dev/null
+ chown bin /var/db/locate.database
+ echo /usr/libexec/locate.updatedb | nice -5 su -m bin 2>/dev/null
chown root.wheel /var/db/locate.database
else
echo "Not rebuilding locate database; no /var/db/locate.database"
#!/bin/sh
#
-# $OpenBSD: concatdb.sh,v 1.3 1996/09/15 23:38:38 deraadt Exp $
+# $OpenBSD: concatdb.sh,v 1.4 1997/01/03 23:33:48 millert Exp $
#
# Copyright (c) September 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
# All rights reserved.
#
# Sequence of databases is important.
#
-# $Id: concatdb.sh,v 1.3 1996/09/15 23:38:38 deraadt Exp $
+# $Id: concatdb.sh,v 1.4 1997/01/03 23:33:48 millert Exp $
# The directory containing locate subprograms
: ${LIBEXECDIR=/usr/libexec}; export LIBEXECDIR
;;
esac
-DTMP=${TMPDIR=/tmp}/_concatdb$$
-bigrams=$DTMP/bigrams
+bigrams=`mktemp ${TMPDIR=/tmp}/_bigrams.XXXXXX` || exit 1
-um=`umask`
-umask 022
-if ! mkdir $DTMP ; then
- echo failed to create tmp dir $DTMP
- exit 1
-fi
-umask $um
-trap 'rm -rf $DTMP' 0 1 2 3 5 10 15
+trap 'rm -f $bigrams' 0 1 2 3 5 10 15
for db
do
do
$locate -d $db /
done | $code $bigrams
-rm -rf $DTMP
#!/bin/sh
#
-# $OpenBSD: mklocatedb.sh,v 1.3 1996/09/15 23:38:38 deraadt Exp $
+# $OpenBSD: mklocatedb.sh,v 1.4 1997/01/03 23:33:49 millert Exp $
#
# Copyright (c) September 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
# All rights reserved.
#
# usage: mklocatedb [-presort] < filelist > database
#
-# $Id: mklocatedb.sh,v 1.3 1996/09/15 23:38:38 deraadt Exp $
+# $Id: mklocatedb.sh,v 1.4 1997/01/03 23:33:49 millert Exp $
# The directory containing locate subprograms
: ${code=locate.code}
: ${sort=sort}
-
sortopt="-u -T $TMPDIR"
sortcmd=$sort
X-nosort|X-presort) sortcmd=cat; sortopt=;shift;;
esac
-DTMP=${TMPDIR=/tmp}/_mklocatedb$$
-bigrams=$DTMP/bigrams
-filelist=$DTMP/list
-
-if ! mkdir $DTMP ; then
- echo failed to create tmp dir $DTMP
- exit 1
-fi
-trap 'rm -rf $DTMP' 0 1 2 3 5 10 15
+bigrams=`mktemp ${TMPDIR=/tmp}/_bigrams.XXXXXX` || exit 1
+trap 'rm -f $bigrams' 0 1 2 3 5 10 15
+filelist=`mktemp ${TMPDIR=/tmp}/_filelist.XXXXXX` || exit 1
+trap 'rm -f $bigrams $filelist' 0 1 2 3 5 10 15
if $sortcmd $sortopt > $filelist; then
$bigram < $filelist | $sort -nr |
$code $bigrams < $filelist
else
echo "`basename $0`: cannot build locate database" >&2
- rm -rf $DTMP
exit 1
fi
-rm -rf $DTMP
#!/bin/sh
#
-# $OpenBSD: updatedb.sh,v 1.5 1996/11/30 18:12:51 millert Exp $
+# $OpenBSD: updatedb.sh,v 1.6 1997/01/03 23:33:49 millert Exp $
#
# Copyright (c) September 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
# All rights reserved.
#
# updatedb - update locate database for local mounted filesystems
#
-# $Id: updatedb.sh,v 1.5 1996/11/30 18:12:51 millert Exp $
+# $Id: updatedb.sh,v 1.6 1997/01/03 23:33:49 millert Exp $
LOCATE_CONFIG="/etc/locate.rc"
if [ -f "$LOCATE_CONFIG" -a -r "$LOCATE_CONFIG" ]; then
done;;
esac
-um=`umask`
-umask 022
-DTMP=${TMPDIR=/tmp}/_updatedb$$
-tmp=$DTMP/updatedb
-if ! mkdir $DTMP ; then
- echo failed to create tmp dir $DTMP
- exit 1
-fi
-umask $um
-trap 'rm -rf $DTMP' 0 1 2 3 5 10 15
+tmp=`mktemp ${TMPDIR=/tmp}/_updatedb.XXXXXX` || exit 1
+trap 'rm -rf $tmp' 0 1 2 3 5 10 15
# search locally
# echo $find $SEARCHPATHS $excludes -or -print && exit
case X"`$find $tmp -size -257c -print`" in
X) cat $tmp > $FCODES;;
*) echo "updatedb: locate database $tmp is empty"
- rm -rf $DTMP
exit 1
esac
fi
-rm -rf $DTMP