rc.single changes (when coming from multi-user): * avoid settling UDev quietly as in rc.sysinit * modules defined in rc.conf are loaded if missing * minilogd is started before udevd as in rc.sysinit rc.sysinit behaviour is unchanged --- functions | 27 +++++++++++++++++++++++++++ rc.single | 19 +++---------------- rc.sysinit | 23 ++--------------------- 3 files changed, 32 insertions(+), 37 deletions(-) diff --git a/functions b/functions index 4e184f6..0c34cb9 100644 --- a/functions +++ b/functions @@ -301,6 +301,33 @@ kill_everything() { run_hook "$1_postkillall" } +# Start/trigger UDev, load MODULES and settle UDev +udevd_modprobe() { + # $1 = where we are being called from. + # This is used to determine which hooks to run. + status "Starting UDev Daemon" udevd --daemon + + run_hook "${1}_udevlaunched" + + stat_busy "Triggering UDev uevents" + udevadm trigger --action=add --type=subsystems + udevadm trigger --action=add --type=devices + stat_done + + # Load modules from the MODULES array defined in rc.conf + if [[ -f /proc/modules ]] && (( ${#MODULES[*]} )); then + status "Loading Modules" modprobe -ab "${MODULES[@]}" + fi + + status "Waiting for UDev uevents to be processed" \ + udevadm settle --timeout=${UDEV_TIMEOUT:-30} + + run_hook "${1}_udevsettled" + + # in case loading a module changed the display mode + calc_columns +} + activate_vgs() { [[ $USELVM = [yY][eE][sS] && -x $(type -P lvm) && -d /sys/block ]] || return # Kernel 2.6.x, LVM2 groups diff --git a/rc.single b/rc.single index 74368fd..46b502c 100755 --- a/rc.single +++ b/rc.single @@ -13,24 +13,11 @@ run_hook single_start if [[ $PREVLEVEL != N ]]; then kill_everything single - status "Starting UDev Daemon" udevd --daemon - - run_hook single_udevlaunched - - # Trigger udev uevents - stat_busy "Triggering UDev uevents" - udevadm trigger --action=add --type=subsystems - udevadm trigger --action=add --type=devices - stat_done - - # Wait for udev uevents - status "Waiting for UDev uevents to be processed" \ - udevadm settle --quiet --timeout=${UDEV_TIMEOUT:-30} - - run_hook single_udevsettled - # start up our mini logger until syslog takes over minilogd + + # Start/trigger UDev, load MODULES and settle UDev + udevd_modprobe single fi run_hook single_end diff --git a/rc.sysinit b/rc.sysinit index 52d9d4b..0d99aa3 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -71,27 +71,8 @@ if [[ $HWCLOCK_PARAMS ]]; then fi fi -status "Starting UDev Daemon" udevd --daemon - -run_hook sysinit_udevlaunched - -stat_busy "Triggering UDev uevents" - udevadm trigger --action=add --type=subsystems - udevadm trigger --action=add --type=devices -stat_done - -# Load modules from the MODULES array defined in rc.conf -if [[ -f /proc/modules ]] && (( ${#MODULES[*]} )); then - status "Loading Modules" modprobe -ab "${MODULES[@]}" -fi - -status "Waiting for UDev uevents to be processed" \ - udevadm settle --timeout=${UDEV_TIMEOUT:-30} - -# in case loading a module changed the display mode -calc_columns - -run_hook sysinit_udevsettled +# Start/trigger UDev, load MODULES and settle UDev +udevd_modprobe sysinit # bring up the loopback interface [[ -d /sys/class/net/lo ]] && -- 1.7.1