/[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 1534 - (show annotations) (download) (as text)
Tue Sep 13 23:24:39 2005 UTC (9 years, 3 months ago) by vapier
File MIME type: text/x-sh
File size: 3799 byte(s)
dont mount $svcdir with -n since /etc/mtab is writable
1 # Copyright 1999-2005 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 # Set the console loglevel to 1 for a cleaner boot
8 # the logger should anyhow dump the ring-0 buffer at start to the
9 # logs, and that with dmesg can be used to check for problems
10 /bin/dmesg -n 1
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 && interactive="yes"
36 if ! start_critical_service "${x}" ; then
37 splash "critical" &>/dev/null &
38
39 echo
40 eerror "One of 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 "${interactive}" > "${svcdir}/interactive"
106
107 # Update the dependency cache
108 /sbin/depscan.sh -u
109
110 # Now that the dependency cache are up to date, make sure these
111 # are marked as started ...
112 (
113 # Needed for mark_service_started()
114 source "${svclib}"/sh/rc-services.sh
115
116 for x in ${CRITICAL_SERVICES} ; do
117 mark_service_started "${x}"
118 done
119 )
120
121 # If the user's /dev/null or /dev/console are missing, we
122 # should help them out and explain how to rectify the situation
123 if [[ ${dev_null} -eq 0 || ${dev_console} -eq 0 ]] && \
124 [[ -e /usr/share/baselayout/issue.devfix ]] ; then
125 # Backup current /etc/issue
126 if [[ -e /etc/issue && ! -e /etc/issue.devfix ]] ; then
127 mv -f /etc/issue /etc/issue.devfix
128 fi
129
130 cp -f /usr/share/baselayout/issue.devfix /etc/issue
131 fi
132
133 # All done logging
134 bootlog quit
135
136
137 # vim:ts=4

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20