From: millert Date: Sat, 4 Jan 1997 01:36:52 +0000 (+0000) Subject: Use new options to locate.updatedb so we don't have to make the X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e294ac80bbc8b8d64ecc48d18052ae76127c1bbf;p=openbsd Use new options to locate.updatedb so we don't have to make the database owned by non-root at any time. --- 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