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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20