--- trunk/magellan-initscripts/etc/rc.d/init.d/rc 2008/03/22 17:54:46 691 +++ trunk/magellan-initscripts/etc/rc.d/init.d/rc 2008/03/22 17:55:21 692 @@ -1,5 +1,5 @@ #!/bin/bash -# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/rc,v 1.18 2008-01-01 13:17:00 niro Exp $ +# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/rc,v 1.19 2008-03-22 17:55:21 niro Exp $ source /etc/sysconfig/rc source $rc_functions @@ -39,23 +39,30 @@ echo CONSOLE=${CONSOLE} > /dev/.udev_populate # populate /dev with devices already found by the kernel - if [ "$(kernel_version | sed 's:\.::g' | cut -d_ -f1)" -gt "2614" ] + echo -e ${COLOREDSTAR}" Populating /dev with existing devices through uevents ..." + if [[ ${RC_COLDPLUG} = yes ]] then - echo -e ${COLOREDSTAR}" Populating /dev with existing devices through uevents ..." - [[ $(udev_version) -ge "96" ]] && [[ ${RC_COLDPLUG} != yes ]] && opts="--attr-match=dev" - /sbin/udevtrigger ${opts} - evaluate_retval + /sbin/udevtrigger else - echo -e ${COLOREDSTAR}" Populating /dev with existing devices with udevstart ..." - /sbin/udevstart - evaluate_retval + # do not run any init-scripts + /sbin/udevadm control --env do_not_run_plug_service=1 + + # only create device nodes + /sbin/udevtrigger --attr-match=dev + + # run persistent-net stuff + /sbin/udevtrigger --subsystem-match=net fi + evaluate_retval # loop until everything is finished echo -e ${COLOREDSTAR}" Letting udev process events ..." /sbin/udevsettle --timeout=60 evaluate_retval + # unset this variable + udevadm control --env do_not_run_plug_service= + rm -f /dev/.udev_populate return 0 } @@ -72,7 +79,7 @@ # copy over any persistant things if [[ -d /lib/udev/devices ]] then - cp --preserve=all --recursive --update /lib/udev/devices/* /dev 2>/dev/null + cp -RPp /lib/udev/devices/* /dev 2>/dev/null fi # not provided by sysfs but needed @@ -81,9 +88,9 @@ ln -snf fd/1 /dev/stdout ln -snf fd/2 /dev/stderr [[ -e /proc/kcore ]] && ln -snf /proc/kcore /dev/core - + # create problematic directories - mkdir -p /dev/{pts,shm} + mkdir -p /dev/pts /dev/shm ) evaluate_retval } @@ -112,159 +119,116 @@ [ -z "${RC_VERBOSE_LEVEL}" ] && RC_VERBOSE_LEVEL=3 echo "${RC_VERBOSE_LEVEL}" > /proc/sys/kernel/printk - # mount sys file system before udev or devfs (kernel-2.6) - if [[ $(kernel_major_version) = 2.6 ]] + # mount sys file system before udev + if [ -d /sys ] then - if [ -d /sys ] - then - echo -e ${COLOREDSTAR}"Mounting sysfs file system ..." - mount -n -t sysfs sysfs /sys - evaluate_retval - else - echo -e ${COLORED}"Fatal: mountpoint /sys missing ..." - echo -e ${COLYELLOW}"Please create the directory /sys (mkdir -p /sys)." - echo -e ${COLYELLOW}"It's essential for a 2.6 kernel." - fi + echo -e ${COLOREDSTAR}"Mounting sysfs file system ..." + mount -n -t sysfs sysfs /sys + evaluate_retval + else + echo -e ${COLORED}"Fatal: mountpoint /sys missing ..." + echo -e ${COLYELLOW}"Please create the directory /sys (mkdir -p /sys)." + echo -e ${COLYELLOW}"It's essential for a 2.6 kernel." fi - ## load devfs ## - # load devfs only with a 2.4 kernel or its really wanted with a 2.6 - if [[ $(kernel_major_version) = 2.4 ]] || [[ ${RC_USED_DEV} = devfs ]] - then - # start devfsd daemon, needed for bootsplash; - # no use of '/etc/rc.d/init.d/devfs' anymore - # check if devfs was mounted by the kernel, - # if not mount it (mbuild_livecd needs this one) - if [ ! -e /dev/.devfsd ] - then - echo -e ${COLOREDSTAR}"Mounting devfs file system ..." - mount -n -t devfs devfs /dev - evaluate_retval - fi - - if [ -e /dev/.devfsd ] - then - echo -e ${COLOREDSTAR}"Starting devfsd ..." - ## directory /lib/dev-state !must! exists ## - /sbin/devfsd /dev &> /dev/null - evaluate_retval - else - echo -e ${COLRED}"No devfs filesystem found ..." - echo -e ${COLYELLOW}"Your Kernel doesn't support the devfs filesystem." - echo -e ${COLYELLOW}"Devfs is necessary to run Magellan-Linux." - echo -e ${COLYELLOW}"Please make shure that this is enabled in your kernel." - echo - echo -e ${COLYELLOW}"Press any key to shutdown the system safely ..." - read - $rc_base/init.d/halt - fi - fi #### load udev #### - # load udev only with a 2.6 kernel - if [[ $(kernel_major_version) = 2.6 ]] && [[ ${RC_USED_DEV} = udev ]] - then - # check if /dev/console exists outside tmpfs - [ -c /dev/console ] ; need_redirect=$? + # check if /dev/console exists outside tmpfs + [ -c /dev/console ] ; need_redirect=$? - # create a ramdisk for populating udev - echo -e ${COLOREDSTAR}"Mounting udev at /dev ..." - # many video drivers needed exec access - fstype=ramfs - # tmpfs was suggested by Greg Kroah-Hartman - kernel_supports_fs tmpfs && fstype=tmpfs - mount -n -t ${fstype} udev /dev -o exec,nosuid,mode=0755,size=10M - evaluate_retval - - # if a device tarball exists load it and if it is activated - echo -e ${COLOREDSTAR}"Configurating system to use udev ..." - if [[ ${RC_DEVICE_TARBALL} = yes ]] - then - echo -e ${COLOREDSTAR}" Populating /dev with saved device nodes ..." - tar -jxpf /lib/udev-state/devices.tar.bz2 -C /dev - evaluate_retval - fi + # create a ramdisk for populating udev + echo -e ${COLOREDSTAR}"Mounting udev at /dev ..." + # many video drivers needed exec access + fstype=ramfs + # tmpfs was suggested by Greg Kroah-Hartman + kernel_supports_fs tmpfs && fstype=tmpfs + mount -n -t ${fstype} udev /dev -o exec,nosuid,mode=0755,size=10M + evaluate_retval - # other eeded device nodes with udev - seed_dev + # if a device tarball exists load it and if it is activated + echo -e ${COLOREDSTAR}"Configurating system to use udev ..." + if [[ ${RC_DEVICE_TARBALL} = yes ]] + then + echo -e ${COLOREDSTAR}" Populating /dev with saved device nodes ..." + tar -jxpf /lib/udev-state/devices.tar.bz2 -C /dev + evaluate_retval + fi - if [ -e /proc/sys/kernel/hotplug ] - then - if [ "$(kernel_version | sed 's:\.::g' | cut -d_ -f1)" -gt "2614" ] - then - echo -e ${COLOREDSTAR}" Using netlink for hotplug events ..." - echo "" > /proc/sys/kernel/hotplug - evaluate_retval - else - echo -e ${COLOREDSTAR}" Setting /sbin/udevsend as hotplug agent ..." - echo "/sbin/udevsend" > /proc/sys/kernel/hotplug - evaluate_retval - fi - else - echo -e ${COLOREDSTAR}${COLYELLOW}" Kernel was not compiled with hotplug support !" - print_status failure - fi + # other eeded device nodes with udev + seed_dev - echo -e ${COLOREDSTAR}" Starting udevd daemon ..." - if [ ${need_redirect} -eq 1 ] - then - # we need to open fds 0 1 2 - /sbin/udevd --daemon /dev/console 2>/dev/console - else - /sbin/udevd --daemon - fi + if [ -e /proc/sys/kernel/hotplug ] + then + echo -e ${COLOREDSTAR}" Using netlink for hotplug events ..." + echo "" > /proc/sys/kernel/hotplug evaluate_retval + else + echo -e ${COLOREDSTAR}${COLYELLOW}" Kernel was not compiled with hotplug support !" + print_status failure + fi - /lib/udev/write_root_link_rule - populate_udev + echo -e ${COLOREDSTAR}" Starting udevd daemon ..." + if [ ${need_redirect} -eq 1 ] + then + # we need to open fds 0 1 2 + /sbin/udevd --daemon /dev/console 2>/dev/console + else + /sbin/udevd --daemon + fi + evaluate_retval - # create nodes that udev can't - echo -e ${COLOREDSTAR}" Finializing udev configuration ..." - [[ -x /sbin/dmsetup ]] && /sbin/dmsetup mknodes &>/dev/null - [[ -x /sbin/lvm ]] && /sbin/lvm vgscan -P --mknodes --ignorelockingfailure &>/dev/null - [[ -x /sbin/evms_activate ]] && /sbin/evms_activate -q &>/dev/null - print_status success + # write root_link rule + /lib/udev/write_root_link_rule + # populate udev device nodes + populate_udev + + # create nodes that udev can't + echo -e ${COLOREDSTAR}" Finializing udev configuration ..." + [[ -x /sbin/dmsetup ]] && /sbin/dmsetup mknodes &>/dev/null + [[ -x /sbin/lvm ]] && /sbin/lvm vgscan -P --mknodes --ignorelockingfailure &>/dev/null + [[ -x /sbin/evms_activate ]] && /sbin/evms_activate -q &>/dev/null + print_status success + + # same thing as /dev/.devfsd + touch /dev/.udev + ## end udev ## - # same thing as /dev/.devfsd - touch /dev/.udev - fi ## load devpts ## # devfs/udev with 2.6 has no ptys, so devpts is also needed - if [[ $(kernel_major_version) = 2.6 ]] + # check if we really have devpts support + if kernel_supports_fs devpts then - # check if we really have devpts support - if kernel_supports_fs devpts + # /dev/pts maybe not exists. + # We only create this directory only if devfs was mounted, + # or it will fail as / is still mounted readonly + # udev has this dir already, only a sanity check for devfs + if [ ! -d "/dev/pts" -a -e "/dev/.devfsd" ] && is_fs_mounted devfs then - # /dev/pts maybe not exists. - # We only create this directory only if devfs was mounted, - # or it will fail as / is still mounted readonly - # udev has this dir already, only a sanity check for devfs - if [ ! -d "/dev/pts" -a -e "/dev/.devfsd" ] && is_fs_mounted devfs - then - mkdir -p /dev/pts &> /dev/null || \ - echo "Could not create /dev/pts !" - fi - - # now mount devpts - if [ -d /dev/pts ] - then - echo -e ${COLOREDSTAR}"Mounting devpts at /dev/pts ..." - mount -n -t devpts -o gid=4,mode=0620 devpts /dev/pts - evaluate_retval - fi - else - # devpts is not supported, give a warning - echo -e ${COLRED}"No devpts filesystem found ..." - echo -e ${COLYELLOW}"Your Kernel doesn't support the devpts filesystem." - echo -e ${COLYELLOW}"Devfs with a kernel-2.6.x needs devpts," - echo -e ${COLYELLOW}"or no pty's are available." - echo -e ${COLYELLOW}"Please make shure that this is enabled in your kernel." - echo - echo -e ${COLYELLOW}"Press any key to continue ..." - read + mkdir -p /dev/pts &> /dev/null || \ + echo "Could not create /dev/pts !" fi + + # now mount devpts + if [ -d /dev/pts ] + then + echo -e ${COLOREDSTAR}"Mounting devpts at /dev/pts ..." + mount -n -t devpts -o gid=4,mode=0620 devpts /dev/pts + evaluate_retval + fi + else + # devpts is not supported, give a warning + echo -e ${COLRED}"No devpts filesystem found ..." + echo -e ${COLYELLOW}"Your Kernel doesn't support the devpts filesystem." + echo -e ${COLYELLOW}"Devfs with a kernel-2.6.x needs devpts," + echo -e ${COLYELLOW}"or no pty's are available." + echo -e ${COLYELLOW}"Please make shure that this is enabled in your kernel." + echo + echo -e ${COLYELLOW}"Press any key to continue ..." + read fi + ## end devpts ## + ## load usbfs ## if kernel_supports_fs usbfs @@ -273,8 +237,9 @@ mount -n -t usbfs usbfs /proc/bus/usb evaluate_retval fi + ## end usbfs ## - ### services state dir ### + ## services state dir ## echo -e ${COLOREDSTAR}"Mounting tmpfs at ${svcdir} ..." mount -n -t tmpfs tmpfs "${svcdir}" -o rw,mode=0644,size="${svcsize}"k evaluate_retval