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