summaryrefslogtreecommitdiff
path: root/etc/weekly
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-01-04 01:36:53 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-01-04 01:36:53 +0000
commite27d09bdbdf823a38f32fd8f43c2ae5adfcc4f1f (patch)
tree9ce87c1692d381bb4ed51036c13b2b97857a402f /etc/weekly
parent8ed127071116c938d28f7f90ce6795b2282e61d1 (diff)
Use new options to locate.updatedb so we don't have to make the
database owned by non-root at any time.
Diffstat (limited to 'etc/weekly')
-rw-r--r--etc/weekly23
1 files changed, 17 insertions, 6 deletions
diff --git a/etc/weekly b/etc/weekly
index bed9e309f0e..17f9c72338c 100644
--- a/etc/weekly
+++ b/etc/weekly
@@ -1,6 +1,6 @@
#!/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
@@ -15,6 +15,7 @@ if [ -f /etc/weekly.local ];then
. /etc/weekly.local
fi
+
#echo ""
#echo "Removing old .o files:"
#find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \;
@@ -57,11 +58,21 @@ echo ""
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