Run the "su -m nobody -c locate.updatedb" in a subshell with cd / first.

"nobody" doesn't have perms to $WEEKLYDIR which was the cwd previously,
and this may cause a warning to be issued by root's shell as part of the su.
This commit is contained in:
lukem 2004-06-27 13:51:55 +00:00
parent 3cf5992cc1
commit 6b00b0a32b
1 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh -
#
# $NetBSD: weekly,v 1.19 2004/04/09 17:35:21 kim Exp $
# $NetBSD: weekly,v 1.20 2004/06/27 13:51:55 lukem Exp $
# from: @(#)weekly 8.2 (Berkeley) 1/2/94
#
@ -78,7 +78,7 @@ if checkyesno rebuild_locatedb; then
echo "Rebuilding locate database:"
chmod 644 /var/db/locate.database
chown nobody:nobody /var/db/locate.database
nice -5 su -m nobody -c /usr/libexec/locate.updatedb 2>/dev/null
(cd / && nice -5 su -m nobody -c /usr/libexec/locate.updatedb 2>/dev/null)
chown root:wheel /var/db/locate.database
else
echo "Not rebuilding locate database; no /var/db/locate.database"