1#!/bin/sh 2# 3# $NetBSD: sysdb,v 1.11 2002/10/08 16:21:52 atatat Exp $ 4# 5 6# PROVIDE: sysdb 7# REQUIRE: mountcritremote 8# BEFORE: DAEMON 9 10. /etc/rc.subr 11 12name="sysdb" 13start_cmd="sysdb_start" 14stop_cmd=":" 15extra_commands="kvmdb devdb utmp" 16kvmdb_cmd="build_kvmdb" 17devdb_cmd="build_devdb" 18utmp_cmd="build_utmp" 19 20sysdb_start() 21{ 22 echo "Building databases..." 23 build_kvmdb 24 build_devdb 25 build_utmp 26} 27 28build_kvmdb() 29{ 30 # Build ps databases. If this kernel supports 31 # machdep.booted_kernel, use that to build the KVM db so dmesg 32 # will run work when we boot /netbsd.new, etc. 33 # 34 booted_kernel=`sysctl -n machdep.booted_kernel 2>/dev/null` 35 kvm_mkdb "${booted_kernel:-/netbsd}" 36} 37 38build_devdb() 39{ 40 if [ /var/run/dev.db -nt /dev ]; then 41 # it's fine 42 else 43 dev_mkdb 44 fi 45} 46 47build_utmp() 48{ 49 # Re-create /var/run/utmp and /var/run/utmpx, which are 50 # deleted by mountcritlocal but can't be recreated by it 51 # because install and chown may not be available then 52 # (possibly no /usr). 53 # 54 install -c -m 664 -g utmp /dev/null /var/run/utmp 55 install -c -m 664 -g utmp /dev/null /var/run/utmpx 56} 57 58load_rc_config $name 59run_rc_command "$1" 60