Browse Source

Use new options to locate.updatedb so we don't have to make the

database owned by non-root at any time.
OPENBSD_2_1
millert 27 years ago
parent
commit
59f88634ac
1 changed files with 17 additions and 6 deletions
  1. +17
    -6
      src/etc/weekly

+ 17
- 6
src/etc/weekly View File

@ -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

Loading…
Cancel
Save