summaryrefslogtreecommitdiff
blob: 82445d27525d9c1594286f3277f94f69bdbfa4ad (plain)
1
2
3
4
5
6
7
8
9
10
11
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
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

# We set the forced softlevel from the kernel command line
# It needs to be run right after proc is mounted for the
# boot runlevel
setup_defaultlevels

# $BOOT can be used by rc-scripts to test if it is the first time
# the 'boot' runlevel is executed.  Now also needed by some stuff in
# the 'sysinit' runlevel ...
export BOOT="yes"

# We first try to find a locally defined list of critical services
# for a particular runlevel.  If we cannot find it, we use the
# defaults.
get_critical_services

export START_CRITICAL="yes"

# We do not want to break compatibility, so we do not fully integrate
# these into /sbin/rc, but rather start them by hand ...
for x in ${CRITICAL_SERVICES} ; do
	if ! start_critical_service "${x}" ; then
		echo
		eerror "One of more critical startup scripts failed to start!"
		einfo "Rebooting"
		/sbin/reboot -f
	fi
done

unset START_CRITICAL

# Check that $svcdir exists ...
check_statedir "${svcdir}"

# Clear $svcdir from stale entries, but leave the caches around, as it
# should help speed things up a bit
rm -rf $(ls -d1 "${svcdir}/"* 2>/dev/null | \
	 grep -ve '\(depcache\|deptree\|envcache\)')

echo "sysinit" > "${svcdir}/softlevel"

# Ensure all critical services have are in the boot runlevel
check_critical_services

# Update the dependency cache
/sbin/depscan.sh

# Now that the dependency cache are up to date, make sure these
# are marked as started ...
(
	# Needed for mark_service_started()
	source "${svclib}"/sh/rc-services.sh
	
	for x in ${CRITICAL_SERVICES} ; do
		mark_service_started "${x}"
	done
)

# sysinit is now done, so allow init scripts to run normally
[[ -e /dev/.rcsysinit ]] && rm -f /dev/.rcsysinit

# vim:ts=4