Bring RCNG in from 5.x and adjust config files and scripts accordingly.
[dragonfly.git] / etc / rc.d / sysdb
1 #!/bin/sh
2 #
3 # $NetBSD: sysdb,v 1.9 2002/03/22 04:34:00 thorpej Exp $
4 # $FreeBSD: src/etc/rc.d/sysdb,v 1.2 2002/06/13 22:14:36 gordon Exp $
5 # $DragonFly: src/etc/rc.d/sysdb,v 1.1 2003/07/24 06:35:37 dillon Exp $
6 #
7 # Note: dev_mkdb is required for 'ps' to work without complaining.
8
9 # PROVIDE: sysdb
10 # REQUIRE: mountcritremote
11 # BEFORE:  DAEMON
12 # KEYWORD: DragonFly FreeBSD
13
14 . /etc/rc.subr
15
16 name="sysdb"
17 start_cmd="sysdb_start"
18 stop_cmd=":"
19
20 sysdb_start()
21 {
22         #       Build ps databases. If this kernel supports
23         #       machdep.booted_kernel, use that to build the KVM db so dmesg
24         #       will run work when we boot /netbsd.new, etc.
25         #
26         echo "Building databases..."
27         sleep 5
28         booted_kernel=`sysctl -n machdep.booted_kernel 2>/dev/null`
29         #kvm_mkdb "${booted_kernel:-/netbsd}"
30         dev_mkdb
31         sleep 5
32
33         #       Re-create /var/run/utmp, which is deleted by mountcritlocal
34         #       but can't be recreated by it because install and chown may
35         #       not be available then (possibly no /usr).
36         #
37         egrep '^utmp:' /etc/group > /dev/null
38         if [ $? ]; then
39                 install -c -m 644 -g wheel /dev/null /var/run/utmp
40         else
41                 install -c -m 664 -g utmp /dev/null /var/run/utmp
42         fi
43 }
44
45 load_rc_config $name
46 run_rc_command "$1"