2000-03-10 14:53:23 +03:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2003-02-24 04:04:45 +03:00
|
|
|
# $NetBSD: sysdb,v 1.12 2003/02/24 01:04:45 atatat Exp $
|
2000-03-10 14:53:23 +03:00
|
|
|
#
|
|
|
|
|
2000-09-19 17:04:38 +04:00
|
|
|
# PROVIDE: sysdb
|
2000-07-26 04:11:48 +04:00
|
|
|
# REQUIRE: mountcritremote
|
2002-03-22 07:33:57 +03:00
|
|
|
# BEFORE: DAEMON
|
2000-03-10 14:53:23 +03:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="sysdb"
|
|
|
|
start_cmd="sysdb_start"
|
|
|
|
stop_cmd=":"
|
2002-10-08 20:21:52 +04:00
|
|
|
extra_commands="kvmdb devdb utmp"
|
|
|
|
kvmdb_cmd="build_kvmdb"
|
|
|
|
devdb_cmd="build_devdb"
|
|
|
|
utmp_cmd="build_utmp"
|
2000-03-10 14:53:23 +03:00
|
|
|
|
|
|
|
sysdb_start()
|
2002-10-08 20:21:52 +04:00
|
|
|
{
|
|
|
|
echo "Building databases..."
|
2003-02-24 04:04:45 +03:00
|
|
|
$kvmdb_cmd
|
|
|
|
$devdb_cmd
|
|
|
|
$utmp_cmd
|
2002-10-08 20:21:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
build_kvmdb()
|
2000-03-10 14:53:23 +03:00
|
|
|
{
|
|
|
|
# Build ps databases. If this kernel supports
|
|
|
|
# machdep.booted_kernel, use that to build the KVM db so dmesg
|
|
|
|
# will run work when we boot /netbsd.new, etc.
|
|
|
|
#
|
2000-10-14 11:33:39 +04:00
|
|
|
booted_kernel=`sysctl -n machdep.booted_kernel 2>/dev/null`
|
2001-04-16 05:38:15 +04:00
|
|
|
kvm_mkdb "${booted_kernel:-/netbsd}"
|
2002-10-08 20:21:52 +04:00
|
|
|
}
|
2000-07-27 17:58:49 +04:00
|
|
|
|
2002-10-08 20:21:52 +04:00
|
|
|
build_devdb()
|
|
|
|
{
|
|
|
|
if [ /var/run/dev.db -nt /dev ]; then
|
|
|
|
# it's fine
|
|
|
|
else
|
|
|
|
dev_mkdb
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
build_utmp()
|
|
|
|
{
|
2002-09-16 06:23:31 +04:00
|
|
|
# Re-create /var/run/utmp and /var/run/utmpx, which are
|
|
|
|
# deleted by mountcritlocal but can't be recreated by it
|
|
|
|
# because install and chown may not be available then
|
|
|
|
# (possibly no /usr).
|
2000-07-27 17:58:49 +04:00
|
|
|
#
|
|
|
|
install -c -m 664 -g utmp /dev/null /var/run/utmp
|
2002-09-16 06:23:31 +04:00
|
|
|
install -c -m 664 -g utmp /dev/null /var/run/utmpx
|
2000-03-10 14:53:23 +03:00
|
|
|
}
|
|
|
|
|
2000-05-13 12:45:06 +04:00
|
|
|
load_rc_config $name
|
2000-03-10 14:53:23 +03:00
|
|
|
run_rc_command "$1"
|