#!/bin/sh -
#
-# $OpenBSD: weekly,v 1.5 1997/01/03 23:33:50 millert Exp $
+# $OpenBSD: weekly,v 1.6 1997/01/04 01:36:52 millert Exp $
#
PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/libexec
. /etc/weekly.local
fi
+
#echo ""
#echo "Removing old .o files:"
#find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \;
echo ""
if [ -f /var/db/locate.database ]; then
- echo "Rebuilding locate database:"
- chmod 644 /var/db/locate.database
- 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
+ TMP=`mktemp /var/db/locate.database.XXXXXX`
+ if [ $? -eq 0 ]; then
+ trap 'rm -f $TMP' 0 1 15
+ echo "Rebuilding locate database:"
+ echo "/usr/libexec/locate.updatedb --fcodes=-" | nice -5 su -m nobody 2>/dev/null 1>$TMP
+ if [ -s "$TMP" ]; then
+ chmod 444 $TMP
+ chown root.wheel $TMP
+ mv -f $TMP /var/db/locate.database
+ else
+ echo "Not installing locate database; zero size"
+ fi
+ else
+ echo "Not rebuilding locate database; can't create temp file"
+ fi
else
echo "Not rebuilding locate database; no /var/db/locate.database"
fi