Reorganize the sysdb script so that lkm{1,2,3} can request that the

dev database be rebuilt after loading modules.  Loading modules might
create new nodes in /dev, but the dev database is being initialized
too soon for lkm2 and lkm3.  This means that, eg, /dev/xf86 (typically
marked AFTERMOUNT and loaded by lkm2) will show up properly.  Reviewed
by lukem.
This commit is contained in:
atatat 2002-10-08 16:21:52 +00:00
parent 164c4e3bec
commit a67080c774
4 changed files with 34 additions and 6 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: lkm1,v 1.6 2000/10/09 06:11:38 nisimura Exp $
# $NetBSD: lkm1,v 1.7 2002/10/08 16:21:52 atatat Exp $
#
# PROVIDE: beforenetlkm
@ -25,6 +25,8 @@ lkm1_start()
set start ; . /etc/rc.lkm
fi
fi
/etc/rc.d/sysdb devdb
}
lkm1_stop()

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: lkm2,v 1.4 2000/09/19 13:04:38 lukem Exp $
# $NetBSD: lkm2,v 1.5 2002/10/08 16:21:52 atatat Exp $
#
# PROVIDE: beforemountlkm
@ -23,6 +23,8 @@ lkm2_start()
else
warn "/etc/rc.lkm not found; LKMs not loaded."
fi
/etc/rc.d/sysdb devdb
}
lkm2_stop()

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: lkm3,v 1.6 2002/03/22 04:33:58 thorpej Exp $
# $NetBSD: lkm3,v 1.7 2002/10/08 16:21:52 atatat Exp $
#
# PROVIDE: aftermountlkm
@ -22,6 +22,8 @@ do_lkm3()
lkmstage=AFTERMOUNT
set $1 ; . /etc/rc.lkm
fi
/etc/rc.d/sysdb devdb
}
load_rc_config lkm

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: sysdb,v 1.10 2002/09/16 02:23:31 perry Exp $
# $NetBSD: sysdb,v 1.11 2002/10/08 16:21:52 atatat Exp $
#
# PROVIDE: sysdb
@ -12,18 +12,40 @@
name="sysdb"
start_cmd="sysdb_start"
stop_cmd=":"
extra_commands="kvmdb devdb utmp"
kvmdb_cmd="build_kvmdb"
devdb_cmd="build_devdb"
utmp_cmd="build_utmp"
sysdb_start()
{
echo "Building databases..."
build_kvmdb
build_devdb
build_utmp
}
build_kvmdb()
{
# 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.
#
echo "Building databases..."
booted_kernel=`sysctl -n machdep.booted_kernel 2>/dev/null`
kvm_mkdb "${booted_kernel:-/netbsd}"
dev_mkdb
}
build_devdb()
{
if [ /var/run/dev.db -nt /dev ]; then
# it's fine
else
dev_mkdb
fi
}
build_utmp()
{
# 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