NetBSD/etc/rc.d/sysdb
2003-05-11 18:17:30 +00:00

48 lines
798 B
Bash
Executable File

#!/bin/sh
#
# $NetBSD: sysdb,v 1.13 2003/05/11 18:17:30 ragge Exp $
#
# PROVIDE: sysdb
# REQUIRE: mountcritremote
# BEFORE: DAEMON
. /etc/rc.subr
name="sysdb"
start_cmd="sysdb_start"
stop_cmd=":"
extra_commands="devdb utmp"
devdb_cmd="build_devdb"
utmp_cmd="build_utmp"
sysdb_start()
{
echo "Building databases..."
$devdb_cmd
$utmp_cmd
}
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
# (possibly no /usr).
#
install -c -m 664 -g utmp /dev/null /var/run/utmp
install -c -m 664 -g utmp /dev/null /var/run/utmpx
}
load_rc_config $name
run_rc_command "$1"