Repository navigation
Expand file tree
/
Copy pathsysdb
More file actions
executable file
·93 lines (81 loc) · 1.55 KB
/
Copy pathsysdb
File metadata and controls
executable file
·93 lines (81 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
A65F
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/sh
#
# $NetBSD: sysdb,v 1.24 2012/06/03 21:42:45 joerg Exp $
#
# PROVIDE: sysdb
# REQUIRE: mountcritremote
# BEFORE: DAEMON
$_rc_subr_loaded . /etc/rc.subr
name="sysdb"
rcvar=$name
start_cmd="sysdb_start"
stop_cmd=":"
extra_commands="devdb utmp services netgroup password"
devdb_cmd="build_devdb"
utmp_cmd="build_utmp"
services_cmd="build_services"
netgroup_cmd="build_netgroup"
password_cmd="build_password"
echo=:
sysdb_start()
{
echo -n "Building databases:"
echo=echo
comma=" "
$devdb_cmd
$utmp_cmd
$services_cmd
$netgroup_cmd
$password_cmd
echo "."
}
check_file()
{
local src="$1"
local db="$2"
shift 2
if [ ! -e "$src" ]; then
return
fi
if [ \( ! -f "$db" \) -o \( "$src" -nt "$db" \) ]; then
$echo -n "$comma$(basename "$src")"
comma=", "
"$@"
fi
}
build_services()
{
check_file /etc/services /var/db/services.cdb services_mkdb -q
}
build_netgroup()
{
check_file /etc/netgroup /var/db/netgroup.db netgroup_mkdb
}
build_devdb()
{
check_file /dev /var/run/dev.db dev_mkdb
check_file /dev /var/run/dev.cdb dev_mkdb
}
build_password()
{
local p=/etc/master.passwd
check_file $p /etc/spwd.db pwd_mkdb -w $p
}
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).
#
local i
for i in "" x; do
if [ ! -f /var/run/utmp$i ]; then
$echo -n "${comma}utmp$i"
comma=", "
install -c -m 664 -g utmp /dev/null /var/run/utmp$i
fi
done
}
load_rc_config $name
run_rc_command "$1"