/[baselayout]/trunk/sbin/init-common-post.sh
Gentoo

Contents of /trunk/sbin/init-common-post.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2091 - (show annotations) (download) (as text)
Wed Jun 14 21:13:31 2006 UTC (8 years, 5 months ago) by uberlord
File MIME type: text/x-sh
File size: 4065 byte(s)
    {start,stop}_volumes moved to rc and halt.sh respectively.

    net services are now depended upon more correctly.
1 # Copyright 1999-2006 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 # Start logging console output since we have all /dev stuff setup
5 bootlog start
6
7 # Start RAID/LVM/EVMS/DM volumes for /usr, /var, etc.
8 for x in ${RC_VOLUME_ORDER} ; do
9 start_addon "${x}"
10 done
11
12 # We set the forced softlevel from the kernel command line
13 # It needs to be run right after proc is mounted for the
14 # boot runlevel
15 setup_defaultlevels
16
17 # $BOOT can be used by rc-scripts to test if it is the first time
18 # the 'boot' runlevel is executed. Now also needed by some stuff in
19 # the 'sysinit' runlevel ...
20 export BOOT="yes"
21
22 # We first try to find a locally defined list of critical services
23 # for a particular runlevel. If we cannot find it, we use the
24 # defaults.
25 get_critical_services
26
27 splash "rc_init" "${argv1}"
28
29 export START_CRITICAL="yes"
30
31 # We do not want to break compatibility, so we do not fully integrate
32 # these into /sbin/rc, but rather start them by hand ...
33 for x in ${CRITICAL_SERVICES} ; do
34 splash "svc_start" "${x}"
35 user_want_interactive && svcinteractive="yes"
36 if ! start_critical_service "${x}" ; then
37 splash "critical" &>/dev/null &
38
39 echo
40 eerror "One or more critical startup scripts failed to start!"
41 eerror "Please correct this, and reboot ..."
42 echo; echo
43 /sbin/sulogin ${CONSOLE}
44 einfo "Unmounting filesystems"
45 /bin/mount -a -o remount,ro &>/dev/null
46 einfo "Rebooting"
47 /sbin/reboot -f
48 fi
49
50 splash "svc_started" "${x}" "0"
51 done
52
53 unset START_CRITICAL
54
55 # /var/log should be writable now, so starting saving the boot output
56 bootlog sync
57
58 # Check that $svcdir exists ...
59 check_statedir "${svcdir}"
60
61 # Should we use tmpfs/ramfs/ramdisk for caching dependency and
62 # general initscript data? Note that the 'gentoo=<fs>' kernel
63 # option should override any other setting ...
64 for fs in tmpfs ramfs ramdisk ; do
65 if get_bootparam "${fs}" ; then
66 svcmount="yes"
67 svcfstype="${fs}"
68 break
69 fi
70 done
71 if [[ ${svcmount} == "yes" ]] ; then
72 ebegin "Mounting ${svcfstype} at ${svcdir}"
73 case "${svcfstype}" in
74 ramfs)
75 try mount -t ramfs svcdir "${svcdir}" \
76 -o rw,mode=0755,size="${svcsize}"k
77 ;;
78 ramdisk)
79 try dd if=/dev/zero of=/dev/ram0 bs=1k count="${svcsize}"
80 try /sbin/mke2fs -i 1024 -vm0 /dev/ram0 "${svcsize}"
81 try mount -t ext2 /dev/ram0 "${svcdir}" -o rw
82 ;;
83 tmpfs|*)
84 try mount -t tmpfs svcdir "${svcdir}" \
85 -o rw,mode=0755,size="${svcsize}"k
86 ;;
87 esac
88 eend 0
89 fi
90
91 # If booting off CD, we want to update inittab before setting the runlevel
92 if [[ -f /sbin/livecd-functions.sh && -n ${CDBOOT} ]] ; then
93 ebegin "Updating inittab"
94 livecd_fix_inittab
95 eend $?
96 /sbin/telinit q &>/dev/null
97 fi
98
99 # Clear $svcdir from stale entries, but leave the caches around, as it
100 # should help speed things up a bit
101 rm -rf $(ls -d1 "${svcdir}/"* 2>/dev/null | \
102 grep -ve '\(depcache\|deptree\|envcache\)')
103
104 echo "sysinit" > "${svcdir}/softlevel"
105 echo "${svcinteractive}" > "${svcdir}/interactive"
106
107 # Ensure all critical services have are in the boot runlevel
108 check_critical_services
109
110 # Update the dependency cache
111 /sbin/depscan.sh
112
113 # Now that the dependency cache are up to date, make sure these
114 # are marked as started ...
115 (
116 # Needed for mark_service_started()
117 source "${svclib}"/sh/rc-services.sh
118
119 for x in ${CRITICAL_SERVICES} ; do
120 mark_service_started "${x}"
121 done
122 )
123
124 # sysinit is now done, so allow init scripts to run normally
125 [[ -e /dev/.rcsysinit ]] && rm -f /dev/.rcsysinit
126
127 # If the user's /dev/null or /dev/console are missing, we
128 # should help them out and explain how to rectify the situation
129 if [[ ${dev_null} -eq 0 || ${dev_console} -eq 0 ]] && \
130 [[ -e /usr/share/baselayout/issue.devfix ]] ; then
131 # Backup current /etc/issue
132 if [[ -e /etc/issue && ! -e /etc/issue.devfix ]] ; then
133 mv -f /etc/issue /etc/issue.devfix
134 fi
135
136 cp -f /usr/share/baselayout/issue.devfix /etc/issue
137 fi
138
139 # Check and save if the user wants interactive
140 user_want_interactive && svcinteractive="yes"
141 echo "${svcinteractive:-no}" > "${svcdir}/interactive"
142
143 # All done logging
144 bootlog quit
145
146 # vim:ts=4

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20