/[baselayout]/trunk/sbin/rc
Gentoo

Contents of /trunk/sbin/rc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 488 - (show annotations) (download)
Sun Apr 25 22:31:48 2004 UTC (15 years, 4 months ago) by agriffis
File size: 19245 byte(s)
Fix typos in sbin/rc: "try try mount" and "mount ... & >/dev/null" Also removed the errstr double-checking since the need for that is alleviated by these typo fixes.

1 #!/bin/bash
2 # Copyright 1999-2004 Gentoo Technologies, Inc.
3 # Distributed under the terms of the GNU General Public License v2
4 # $Header$
5
6
7 trap ":" INT QUIT TSTP
8 source /sbin/functions.sh
9 # Only source this when this is a livecd booting ...
10 [ -f /sbin/livecd-functions.sh ] && source /sbin/livecd-functions.sh
11 umask 022
12
13 try() {
14 local errstr
15 local retval=0
16
17 if [ -c /dev/null ]; then
18 errstr="$((eval $*) 2>&1 >/dev/null)"
19 else
20 errstr="$((eval $*) 2>&1)"
21 fi
22 retval=$?
23 if [ "${retval}" -ne 0 ]
24 then
25 # Progressbar begin
26 if [ -c /dev/null ]; then
27 rc_splash "stop" &>/dev/null &
28 else
29 rc_splash "stop" &
30 fi
31 # Progressbar end
32
33 echo -e "${ENDCOL}${NORMAL}[${BAD} oops ${NORMAL}]"
34 echo
35 eerror "The \"${1}\" command failed with error:"
36 echo
37 echo "${errstr#*: }"
38 echo
39 eerror "Since this is a critical task, startup cannot continue."
40 echo
41 /sbin/sulogin ${CONSOLE}
42 einfo "Unmounting filesystems"
43 if [ -c /dev/null ]; then
44 /bin/mount -a -o remount,ro & >/dev/null
45 else
46 /bin/mount -a -o remount,ro
47 fi
48 einfo "Rebooting"
49 /sbin/reboot -f
50 fi
51
52 return ${retval}
53 }
54
55 # Check that $1 exists ...
56 check_statedir() {
57 [ -z "$1" ] && return 0
58
59 if [ ! -d "$1" ]
60 then
61 if ! mkdir -p "$1" &>/dev/null
62 then
63 echo
64 eerror "For Gentoo Linux to function properly, \"$1\" need to exist."
65 eerror "Please mount your root partition read/write, and execute:"
66 echo
67 eerror " # mkdir -p $1"
68 echo; echo
69 /sbin/sulogin ${CONSOLE}
70 einfo "Unmounting filesystems"
71 /bin/mount -a -o remount,ro & >/dev/null
72 einfo "Rebooting"
73 /sbin/reboot -f
74 fi
75 fi
76
77 return 0
78 }
79
80 populate_udev() {
81 /sbin/udevstart
82
83 # Not provided by sysfs but needed
84 ln -snf /proc/self/fd /dev/fd
85 ln -snf fd/0 /dev/stdin
86 ln -snf fd/1 /dev/stdout
87 ln -snf fd/2 /dev/stderr
88 ln -snf /proc/kcore /dev/core
89 ln -snf /proc/asound/oss/sndstat /dev/sndstat
90
91 # Create problematic directories
92 mkdir -p /dev/{pts,shm}
93
94 # Same thing as /dev/.devfsd
95 touch /dev/.udev
96
97 return 0
98 }
99
100 get_critical_services() {
101 local x=
102 CRITICAL_SERVICES=
103
104 if [ -f "/etc/runlevels/${BOOTLEVEL}/.critical" ]
105 then
106 for x in $(< /etc/runlevels/${BOOTLEVEL}/.critical)
107 do
108 CRITICAL_SERVICES="${CRITICAL_SERVICES} ${x##*/}"
109 done
110 else
111 CRITICAL_SERVICES="checkroot hostname modules checkfs localmount"
112 fi
113
114 export CRITICAL_SERVICES
115
116 return 0
117 }
118
119 # Save $1
120 argv1="$1"
121
122 # Progressbar begin
123 rc_splash_init
124 # Progressbar end
125
126 # First time boot stuff goes here. Note that 'sysinit' is an internal runlevel
127 # used to bring up local filesystems, and should not be started with /sbin/rc
128 # directly ...
129 if [ "${RUNLEVEL}" = "S" -a "${argv1}" = "sysinit" ]
130 then
131 # Setup initial $PATH just in case
132 PATH="/bin:/sbin:/usr/bin:/usr/sbin:${PATH}"
133
134 if [ ! -c /dev/null ] ; then
135 echo -e "${BAD}Your root filesystem is missing /dev/null${NORMAL}"
136 echo -e "${BAD}You should really get this sorted out.${NORMAL}"
137 fi
138
139 echo
140 echo -e "${GOOD}Gentoo Linux${GENTOO_VERS}; ${BRACKET}http://www.gentoo.org/${NORMAL}"
141 echo -e " Copyright 2001-2004 Gentoo Technologies, Inc.; Distributed under the GPL"
142 echo
143
144 check_statedir /proc
145
146 ebegin "Mounting proc at /proc"
147 try mount -n -t proc none /proc
148 eend $?
149
150 # Read off the kernel commandline to see if there's any special settings
151 # especially check to see if we need to set the CDBOOT environment variable
152 # Note: /proc MUST be mounted
153 [ -f /sbin/livecd-functions.sh ] && livecd_read_commandline
154
155 if [ -d /sys -a "$(get_KV)" -ge "$(KV_to_int '2.6.0')" ]
156 then
157 ebegin "Mounting sysfs at /sys"
158 mount -t sysfs none /sys
159 eend $?
160
161 elif [ "$(get_KV)" -ge "$(KV_to_int '2.6.0')" ]
162 then
163 ewarn "No /sys to mount sysfs needed in 2.6 and later kernels!"
164 fi
165
166 check_statedir /dev
167
168 devfs="yes"
169 udev="yes"
170
171 # Check if we can use udev, and that the user did not disable
172 # it explicitly ...
173 if get_bootparam "noudev" || \
174 [ ! -x /sbin/udev -o -e "/dev/.devfsd" ] || \
175 [ "$(get_KV)" -lt "$(KV_to_int '2.6.0')" ]
176 then
177 udev="no"
178 fi
179
180 # Check if the user disabled devfs explicitly
181 if get_bootparam "nodevfs" || [ "${udev}" = "yes" ]
182 then
183 devfs="no"
184 fi
185
186 # Fix weird bug where there is a /dev/.devfsd in a unmounted /dev
187 mymounts="$(awk '($3 == "devfs") { print "yes"; exit 0 }' /proc/mounts)"
188 if [ -e "/dev/.devfsd" -a "${mymounts}" != "yes" ]
189 then
190 rm -f /dev/.devfsd
191 fi
192
193 if [ "${udev}" = "yes" ]
194 then
195 ebegin "Mounting ramfs at /dev"
196 try mount -n -t ramfs none /dev
197 eend $?
198 ebegin "Configuring system to use udev"
199 if [ "${RC_DEVICE_TARBALL}" = "yes" ]
200 then
201 einfo " Populating /dev with device nodes..."
202 try tar -jxpf /lib/udev-state/devices.tar.bz2 -C /dev
203 fi
204 populate_udev
205 if [ -e /proc/sys/kernel/hotplug -a -x /sbin/hotplug ]
206 then
207 einfo " Using /sbin/hotplug for udev management..."
208
209 elif [ -e /proc/sys/kernel/hotplug ]
210 then
211 einfo " Setting /sbin/udev as hotplug agent..."
212 echo "/sbin/udev" > /proc/sys/kernel/hotplug
213 else
214 ewarn " Kernel was not compiled with hotplug support!"
215 fi
216 eend 0
217
218 # With the new way, /dev can be mounted by the kernel ...
219 elif [ "${devfs}" = "yes" -a ! -e "/dev/.devfsd" ]
220 then
221 mymounts="$(awk '($2 == "devfs") { print "yes"; exit 0 }' /proc/filesystems)"
222 # Is devfs support compiled in?
223 if [ "${mymounts}" = "yes" ]
224 then
225 ebegin "Mounting devfs at /dev"
226 try mount -n -t devfs none /dev
227 eend $?
228 else
229 clear
230 echo
231 einfo "The Gentoo Linux system initialization scripts have detected that your"
232 einfo "kernel has been compiled without DEVFS support. Because Gentoo Linux"
233 einfo "has been designed to work with DEVFS, it is required that you compile"
234 einfo "support for it into your kernel. Please read the 'Gentoo Linux from"
235 einfo "source (build) CD Installation Guide' at:"
236 echo
237 einfo " http://www.gentoo.org/doc/build.html"
238 echo
239 einfo "for more information on how to do this."
240 echo
241 read -t 15 -p "(hit Enter to continue or wait 15 seconds...)"
242 fi
243 fi
244
245 # From linux-2.5.68 we need to mount /dev/pts again ...
246 if [ "$(get_KV)" -ge "$(KV_to_int '2.5.68')" ]
247 then
248 have_devpts="$(awk '($2 == "devpts") { print "yes"; exit 0 }' /proc/filesystems)"
249 mymounts="$(awk '($3 == "devfs") { print "yes"; exit 0 }' /proc/mounts)"
250
251 if [ "${have_devpts}" = "yes" ]
252 then
253 # Only try to create /dev/pts if we have /dev mounted as devfs,
254 # else it might fail as / might be still mounted readonly.
255 if [ ! -d /dev/pts -a -e "/dev/.devfsd" -a "${mymounts}" = "yes" ]
256 then
257 # Make sure we have /dev/pts
258 mkdir -p /dev/pts &>/dev/null || \
259 ewarn "Could not create /dev/pts!"
260
261 fi
262
263 if [ -d /dev/pts ]
264 then
265 ebegin "Mounting devpts at /dev/pts"
266 try mount -n -t devpts -o gid=5,mode=0620 none /dev/pts
267 eend $?
268 fi
269 fi
270 fi
271
272 # Need devfsd running now so that /dev/ram0 exists if we need it
273 mymounts="$(awk '($3 == "devfs") { print "yes"; exit 0 }' /proc/mounts)"
274 if [ "${devfs}" = "yes" -a -e "/dev/.devfsd" -a \
275 "${mymounts}" = "yes" ]
276 then
277 if [ "${RC_DEVFSD_STARTUP}" != "no" ]
278 then
279 ebegin "Starting devfsd"
280 /sbin/devfsd /dev > /dev/null
281 eend $?
282 fi
283 fi
284
285 # Update splash wrappers.
286 update_splash_wrappers
287 # Progressbar begin
288 rc_splash "text"
289 # Progressbar end
290
291 if [ -x /sbin/irqbalance -a "$(get_KV)" -ge "$(KV_to_int '2.5.0')" ]
292 then
293 ebegin "Starting irqbalance"
294 /sbin/irqbalance
295 eend $?
296 fi
297
298 # Mount either a ramdisk or tmpfs if requested.
299 # we do this to temp mount, until we can get /var mounted ...
300 tsvcdir="/mnt/.init.d"
301
302 # Should we use tmpfs or a ramdisk for caching dependency and
303 # general initscript data? Note that the 'gentoo=tmpfs' kernel
304 # option should override most settings ...
305 if get_bootparam "tmpfs" || \
306 [ "${svcmount}" = "yes" -a "${svcfstype}" = "tmpfs" ]
307 then
308 check_statedir "${tsvcdir}"
309
310 ebegin "Mounting tmpfs at ${tsvcdir}"
311 try mount -n -t tmpfs tmpfs "${tsvcdir}" \
312 -o rw,mode=0644,size="${svcsize}"k
313 eend 0
314
315 elif get_bootparam "ramfs" || \
316 [ "${svcmount}" = "yes" -a "${svcfstype}" = "ramfs" ]
317 then
318 check_statedir "${tsvcdir}"
319
320 ebegin "Mounting ramdisk 0 at ${tsvcdir}"
321 try dd if=/dev/zero of=/dev/ram0 bs=1k count="${svcsize}"
322 try /sbin/mke2fs -i 1024 -vm0 /dev/ram0 "${svcsize}"
323 try mount -n -t ext2 /dev/ram0 "${tsvcdir}" -o rw
324 eend 0
325 fi
326
327 # Swap needs to be activated *after* devfs has been mounted and *after*
328 # devfsd has been started, so that the fstab can be properly parsed
329 # and only if the server/Gentoo box is initialized ...
330 ebegin "Activating (possible) swap"
331 /sbin/swapon -a &> /dev/null
332 eend 0
333
334 # Set the console loglevel to 1 for a cleaner boot
335 # the logger should anyhow dump the ring-0 buffer at start to the
336 # logs, and that with dmesg can be used to check for problems
337 /bin/dmesg -n 1
338
339 # We set the forced softlevel from the kernel command line
340 # It needs to be run right after proc is mounted for the
341 # boot runlevel
342 setup_defaultlevels
343
344 # $BOOT can be used by rc-scripts to test if it is the first time
345 # the 'boot' runlevel is executed. Now also needed by some stuff in
346 # the 'sysinit' runlevel ...
347 export BOOT="yes"
348
349 start_critical_service() {
350 (
351 local retval=
352
353 source "/etc/init.d/${x}" || eerror "Failed to source /etc/init.d/${x}"
354 retval=$?
355 [ "${retval}" -ne 0 ] && return "${retval}"
356
357 start || eerror "Failed to start /etc/init.d/${x}"
358 retval=$?
359
360 return "${retval}"
361 )
362 }
363
364 # We first try to find a locally defined list of critical services
365 # for a particular runlevel. If we cannot find it, we use the
366 # defaults.
367 get_critical_services
368
369 # We do not want to break compatibility, so we do not fully integrate
370 # these into /sbin/rc, but rather start them by hand ...
371 for x in ${CRITICAL_SERVICES}
372 do
373 # Progressbar begin
374 rc_splash_update "inline" "${x}" "start"
375 # Progressbar end
376
377 if ! start_critical_service "${x}"
378 then
379 # Progressbar begin
380 rc_splash "stop" &> /dev/null &
381 # Progressbar end
382
383 echo
384 eerror "One of more critical startup scripts failed to start!"
385 eerror "Please correct this, and reboot ..."
386 echo; echo
387 /sbin/sulogin ${CONSOLE}
388 einfo "Unmounting filesystems"
389 /bin/mount -a -o remount,ro &>/dev/null
390 einfo "Rebooting"
391 /sbin/reboot -f
392 fi
393 done
394 # Check that $svcdir exists ...
395 check_statedir "${svcdir}"
396
397 # Since we are using tmpfs or ramfs, just bin to $tsvcdir to $svcdir
398 if get_bootparam "tmpfs" || get_bootparam "ramfs" || [ "${svcmount}" = "yes" ]
399 then
400 mount --bind "${tsvcdir}" "${svcdir}"
401 fi
402
403 # If booting off CD, we want to update inittab before setting the runlevel
404 if [ -f "/sbin/livecd-functions.sh" -a -n "${CDBOOT}" ]
405 then
406 ebegin "Updating inittab"
407 livecd_fix_inittab
408 eend $?
409 /sbin/telinit q &>/dev/null
410 fi
411
412 # Clear $svcdir from stale entries
413 rm -rf "${svcdir}"/*
414
415 # Update the dependency cache
416 /sbin/depscan.sh
417
418 # Now that the dependency cache are up to date, make sure these
419 # are marked as started ...
420 (
421 # Needed for mark_service_started()
422 source "${svclib}/sh/rc-services.sh"
423
424 for x in ${CRITICAL_SERVICES}
425 do
426 mark_service_started "${x}"
427 done
428 )
429 fi # Sysinit ends here
430
431 # Update splash wrappers.
432 update_splash_wrappers
433
434 if [ "${RUNLEVEL}" = "S" -a "${argv1}" = "sysinit" ]
435 then
436 # Progressbar begin
437 rc_splash_debug "${argv1}"
438 # Progressbar end
439 exit 0
440
441 elif [ "${RUNLEVEL}" = "S" -a "${argv1}" = "boot" ]
442 then
443 setup_defaultlevels
444
445 if [ -n "${DEFAULTLEVEL}" -a "${DEFAULTLEVEL}" != "default" ]
446 then
447 # Setup our default runlevel runlevel that will be run
448 # the first time /sbin/rc is called with argv1 != sysinit|boot
449 echo "${DEFAULTLEVEL}" > "${svcdir}/ksoftlevel"
450 fi
451
452 # $BOOT can be used by rc-scripts to test if it is the first time
453 # the 'boot' runlevel is executed
454 export BOOT="yes"
455
456 # We reset argv1 to the bootlevel given on the kernel command line
457 # if there is one
458 argv1="${BOOTLEVEL}"
459
460 elif [ "${RUNLEVEL}" != "S" -a -e "${svcdir}/ksoftlevel" ]
461 then
462 argv1="$(< ${svcdir}/ksoftlevel)"
463 rm -f "${svcdir}/ksoftlevel"
464 fi
465
466
467 source "${svclib}/sh/rc-services.sh"
468 source "${svclib}/sh/rc-daemon.sh"
469
470 if [ -f "${svcdir}/softlevel" ]
471 then
472 # Set OLDSOFTLEVEL if we had a valid SOFTLEVEL
473 export OLDSOFTLEVEL="$(< ${svcdir}/softlevel)"
474 else
475 export OLDSOFTLEVEL=
476 fi
477
478 if [ -z "${argv1}" ]
479 then
480 if [ -f "${svcdir}/softlevel" ]
481 then
482 export SOFTLEVEL="$(< ${svcdir}/softlevel)"
483 else
484 export SOFTLEVEL="${BOOTLEVEL}"
485 fi
486 else
487 export SOFTLEVEL="${argv1}"
488 fi
489
490 if [ ! -f "${svcdir}/softlevel" ]
491 then
492 echo "${SOFTLEVEL}" > "${svcdir}/softlevel"
493 fi
494
495 # Progressbar begin
496 rc_splash_calc
497 # Progressbar end
498
499 # For keeping a list of services that fails during boot/halt
500 if [ ! -d "${svcdir}/failed" ]
501 then
502 mkdir -p -m 0755 "${svcdir}/failed"
503 else
504 rm -rf "${svcdir}"/failed/*
505 fi
506
507 if [ "${SOFTLEVEL}" = "reboot" -o "${SOFTLEVEL}" = "shutdown" ]
508 then
509 myscripts=
510
511 elif [ "${SOFTLEVEL}" = "single" ]
512 then
513 get_critical_services
514
515 myscripts="${CRITICAL_SERVICES}"
516
517 elif [ ! -d "/etc/runlevels/${SOFTLEVEL}" ]
518 then
519 eerror "ERROR: runlevel ${SOFTLEVEL} does not exist; exiting..."
520 exit 1
521 else
522 myscripts=
523 if [ "${SOFTLEVEL}" != "${BOOTLEVEL}" ]
524 then
525 # Normal runlevels *include* boot scripts
526 mylevels="$(dolisting "/etc/runlevels/${SOFTLEVEL}/")"
527 mylevels="${mylevels} $(dolisting /etc/runlevels/${BOOTLEVEL}/)"
528 else
529 # Non-normal runlevels don't include boot scripts as default
530 mylevels="$(dolisting "/etc/runlevels/${SOFTLEVEL}/")"
531 fi
532
533 [ "${OLDSOFTLEVEL}" = "${BOOTLEVEL}" -o "${OLDSOFTLEVEL}" = "single" ] \
534 && /bin/dmesg -n 1
535
536 for x in ${mylevels}
537 do
538 [ -L "${x}" ] && myscripts="${myscripts} ${x##*/}"
539 done
540 fi
541
542 # The softscripts dir contains all scripts that belong to the
543 # runlevel specified in ${svcdir}/softlevel
544 # It needs to be a new directory, else when stopping the services
545 # and the old directory is not intact, things get broken
546
547 mkdir -p -m 0755 "${svcdir}/softscripts.new"
548
549 for x in ${myscripts}
550 do
551 if [ ! -e "/etc/init.d/${x}" ]
552 then
553 ewarn "WARNING: /etc/init.d/${x} missing; skipping..."
554 continue
555 fi
556 # The -f eliminates a warning if the symlink already exists,
557 # which can happen if a service is in both the boot level and
558 # the current "normal" runlevel
559 ln -snf "/etc/init.d/${x}" "${svcdir}/softscripts.new/${x}"
560 done
561
562 dep_stop() {
563 local x=
564 local dep=
565 local needsme=
566 local myservice="${1##*/}"
567 local depservice=
568
569 if ! service_started "${myservice}"
570 then
571 return 0
572 fi
573
574 # Candidate for zapping
575 if [ ! -L "${svcdir}/softscripts.new/${myservice}" ]
576 then
577 # If this is a 'net' service, we do not want to stop it if it was
578 # not in the previous runlevel, and we are not shutting down,
579 # rebooting or going to single runlevel. This is because the user
580 # might have started it (net.ppp?), or possibly hotplug ...
581 if [ "${myservice%%.*}" = "net" -a \
582 "${myservice##*.}" != "${myservice}" ] && \
583 [ "${SOFTLEVEL}" != "reboot" -a \
584 "${SOFTLEVEL}" != "shutdown" -a \
585 "${SOFTLEVEL}" != "single" ]
586 then
587 if [ -n "${OLDSOFTLEVEL}" ] && \
588 ! in_runlevel "${myservice}" "${OLDSOFTLEVEL}"
589 then
590 # This service is not in the previous runlevel, so
591 # do not stop it ...
592 return 0
593 fi
594 fi
595
596 # Should not work for 'use'
597 if [ -z "$(needsme "${myservice}")" ]
598 then
599 # Nothing depends on me
600 stop_service "${myservice}"
601 else
602 # Something may depend on me
603 needsme=0
604
605 for dep in $(needsme "${myservice}")
606 do
607 if service_started "${dep}" && \
608 [ -L "${svcdir}/softscripts.new/${dep}" ]
609 then
610 # This dep is valid
611 needsme=1
612
613 break
614 fi
615 done
616
617 if [ "${needsme}" -eq 0 ]
618 then
619 stop_service "${myservice}"
620 fi
621 fi
622 fi
623 }
624
625 # Stop services
626 if [ "${SOFTLEVEL}" != "single" -a \
627 "${SOFTLEVEL}" != "reboot" -a \
628 "${SOFTLEVEL}" != "shutdown" ]
629 then
630 for i in $(dolisting "${svcdir}/started/")
631 do
632 dep_stop "${i}"
633 done
634 else
635 get_critical_services
636
637 is_critical_service() {
638 local x=
639 local myservice="${1##*/}"
640
641 for x in ${CRITICAL_SERVICES}
642 do
643 if [ "${myservice}" = "${x}" ]
644 then
645 return 0
646 fi
647 done
648
649 return 1
650 }
651
652 # First stop non critical services
653 for i in $(dolisting "${svcdir}/started/")
654 do
655 if [ -n "${LOGGER_SERVICE}" ]
656 then
657 # Only stop it if the logger do not depends on it
658 if ! query_before "${i##*/}" "${LOGGER_SERVICE}"
659 then
660 continue
661 fi
662 fi
663
664 # Do not stop critical services just yet
665 is_critical_service "${i}" || dep_stop "${i}"
666 done
667
668 # Now stop the logger if running
669 if [ -n "${LOGGER_SERVICE}" ]
670 then
671 dep_stop "${LOGGER_SERVICE}"
672 fi
673
674 # Now stop the rest
675 for i in $(dolisting "${svcdir}/started/")
676 do
677 dep_stop "${i}"
678 done
679 fi
680
681 # Only change softlevel AFTER all the services have been stopped,
682 # else they will not get the depend's right (wrong SOFTLEVEL)
683
684 echo "${SOFTLEVEL}" > "${svcdir}/softlevel"
685
686 if [ "${SOFTLEVEL}" = "reboot" -o "${SOFTLEVEL}" = "shutdown" ]
687 then
688 source /sbin/functions.sh
689
690 # Progressbar begin
691 rc_splash_debug "${SOFTLEVEL}"
692 # Progressbar end
693
694 # Make sure that our $svcdir are clean for next reboot ...
695 rm -rf "${svcdir}"/*
696
697 source /etc/init.d/halt.sh
698
699 if [ "${SOFTLEVEL}" = "reboot" ]
700 then
701 source /etc/init.d/reboot.sh
702 else
703 source /etc/init.d/shutdown.sh
704 fi
705
706 # Should never get here
707 exit 0
708 fi
709
710 # Move the old softscritps directory to a different one
711 # and make the new softscripts directory the current
712
713 mv -f "${svcdir}/softscripts" "${svcdir}/softscripts.old"
714 mv -f "${svcdir}/softscripts.new" "${svcdir}/softscripts"
715
716 dep_start() {
717 local myservice="${1##*/}"
718
719 [ ! -L "${svcdir}/softscripts/${myservice}" ] && continue
720
721 # Only start a script if it isn't already running
722 service_started "${myservice}" || schedule_service_startup "${myservice}"
723 }
724
725 get_critical_services
726
727 EXTRA_SOFTSCRIPTS="${CRITICAL_SERVICES}"
728
729 if [ -n "${LOGGER_SERVICE}" -a -L "${svcdir}/softscripts/${LOGGER_SERVICE}" ]
730 then
731 service_started "${LOGGER_SERVICE}" || \
732 EXTRA_SOFTSCRIPTS="${EXTRA_SOFTSCRIPTS} ${LOGGER_SERVICE}"
733 fi
734
735 if [ "${SOFTLEVEL}" != "${BOOTLEVEL}" ]
736 then
737 for i in $(dolisting "/etc/runlevels/${BOOTLEVEL}/")
738 do
739 [ -L "${svcdir}/softscripts/${i##*/}" ] && \
740 EXTRA_SOFTSCRIPTS="${EXTRA_SOFTSCRIPTS} ${i##*/}"
741 done
742 fi
743
744 # Start scripts
745 for i in ${EXTRA_SOFTSCRIPTS} $(dolisting "${svcdir}/softscripts/")
746 do
747 dep_start "${i##*/}"
748 done
749
750 # Wait for any services that may still be running ...
751 [ "${RC_PARALLEL_STARTUP}" = "yes" ] && wait
752
753 # Clean the old runlevel
754 rm -rf "${svcdir}/softscripts.old" &> /dev/null
755
756 # Depends gets nuked, so update them
757 # (this problem should be solved now, but i think it will be a good idea
758 # to recreate the deps after a change in runlevel)
759
760 #/sbin/depscan.sh &>/dev/null
761
762 # We want devfsd running after a change of runlevel (this is mostly if we return
763 # from runlevel 'single')
764 if [ -z "`ps --no-heading -C 'devfsd'`" -a \
765 -n "`gawk '/\/dev devfs/ { print }' /proc/mounts 2> /dev/null`" ]
766 then
767 if [ "${RC_DEVFSD_STARTUP}" != "no" ]
768 then
769 /sbin/devfsd /dev &> /dev/null
770 fi
771 fi
772
773 # Runlevel end, so clear stale fail list
774 rm -rf "${svcdir}/failed" &> /dev/null
775
776 # If we were in the boot runlevel, it is done now ...
777 [ -n "${BOOT}" ] && unset BOOT
778
779 # Progressbar begin
780 rc_splash_debug "${SOFTLEVEL}"
781 # Progressbar end
782
783
784 # vim:ts=4

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.20