SOURCES: start_udev - started work on 082

freetz freetz at pld-linux.org
Thu Jan 26 17:49:25 CET 2006


Author: freetz                       Date: Thu Jan 26 16:49:25 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- started work on 082

---- Files affected:
SOURCES:
   start_udev (1.29 -> 1.30) 

---- Diffs:

================================================================
Index: SOURCES/start_udev
diff -u SOURCES/start_udev:1.29 SOURCES/start_udev:1.30
--- SOURCES/start_udev:1.29	Mon Jan 23 23:56:18 2006
+++ SOURCES/start_udev	Thu Jan 26 17:49:20 2006
@@ -36,7 +36,6 @@
 prog=udev
 bin=/sbin/udev
 udevd=/sbin/udevd
-MAKEDEV="/sbin/MAKEDEV"
 
 make_extra_nodes () {
 	grep '^[^#]' /etc/udev/links.conf | \
@@ -45,7 +44,6 @@
 	    case "$type" in
     		L) ln -s $arg1 $udev_root/$name ;;
 	        D) mkdir -p $udev_root/$name ;;
-    		M) mknod --mode=600 $udev_root/$name $arg1 ;;
 	        *) echo "links.conf: unparseable line ($type $name $arg1)" ;;
 	    esac
 	done
@@ -59,100 +57,17 @@
 	fi
 }
 
-# we cannot use /usr/bin/find here
-find_d () {
-	where=$1
-	what=$2
-	found=""
-	for f in $where/*; do
-		if [ -d "$f" -a ! -L "$f" ]; then
-			if [ "$f" != "${f%%$what}" ];then 
-				# make sure we are at the path end
-				# we have no dirname and basename
-				rest="${f#*$what}"
-				[ "${rest##*/}" = "$rest" ] && found="$found $f"
-			fi
-			found="$found $(find_d $f $what)"
-		fi
-	done
-	echo "$found"
-}
-
-# we cannot use /usr/bin/find here
-find_f () {
-	where=$1
-	what=$2
-	found=""
-	for f in $where/*; do
-		if [ -d "$f" -a ! -L "$f" ]; then
-			found="$found $(find_f $f $what)"
-		elif [ -e "$f" ]; then 
-			[ "$where/" = "${f%$what}" ] && found="$found $f"
-		fi
-	done
-	[ -n "$found" ] && echo "$found"
-}
-
-# call hotplug with the scsi devices
-scsi_replay () {
-	HOTPLUG="/sbin/udevsend"
-
-	scsi_hosts=$(find_d /sys/devices host\*)
-	SEQNUM=1
-
-	for host in $scsi_hosts; do
-		[ -d $host ] || continue
-		devs=$(find_f $host type)
-		for dev in $devs;do
-			[ -f $dev ] || continue
-			DEVPATH=${dev%/type}
-			DEVPATH=${DEVPATH#/sys}
-			/bin/env -i DEVPATH="$DEVPATH" SUBSYSTEM=scsi_device ACTION=add $HOTPLUG scsi_device
-			/bin/env -i DEVPATH="$DEVPATH" ACTION=add SUBSYSTEM=scsi $HOTPLUG scsi
-		done
-	done
-	return 0
-}
-
-ide_scan() {
-	if [ ! -d /proc/ide ]; then
-		return 1
-	fi
-	for i in /proc/ide/*/media; do
-		read media < "$i"
-		case "$media" in
-			disk)
-				module=ide-disk
-			;;
-			cdrom)
-				module=ide-cd
-			;;
-			tape)
-				module=ide-tape
-			;;
-			floppy)
-				module=ide-floppy
-			;;
-			*)
-				module=ide-generic
-			;;
-		esac
-		/sbin/modprobe $module
-	done
-	return 0
-}
-
 supported_kernel() {
-    case "$(uname -r)" in
+    if [ -f "/sys/class/tty/console/uevent" ]; then
     2.[012345].*) return 1 ;;
     esac
     return 0
 }
 
 set_hotplug_handler() {
-    echo /sbin/udevsend > /proc/sys/kernel/hotplug
+    echo "" > /proc/sys/kernel/hotplug
 }
-
+																		        return 0                                             
 export ACTION=add
 prog=udev
 ret=0
@@ -161,14 +76,11 @@
 
 if ! supported_kernel; then
     fail
-    echo "udev requires a kernel >= 2.6.x, not started."
-    exit 0                                                
 fi
-
 # mount the tmpfs on ${udev_root%/}, if not already done
 LANG=C awk "\$2 == \"${udev_root%/}\" && \$3 == \"tmpfs\" { exit 1 }" /proc/mounts && {
-	if LANG=C fgrep -q "none ${udev_root%/}/pts " /proc/mounts; then
-		PTSDIR=$(mktemp -d ${TMPDIR:-/tmp}/tmpXXXXXX)
+    	if LANG=C fgrep -q "none ${udev_root%/}/pts " /proc/mounts; then
+    		PTSDIR=$(mktemp -d ${TMPDIR:-/tmp}/tmpXXXXXX)
 		mount --move $udev_root/pts "$PTSDIR"
 	fi
 	if LANG=C fgrep -q "none ${udev_root%/}/shm " /proc/mounts; then
@@ -190,39 +102,21 @@
 	ret=$(( $ret + $? ))
 }
 
-
 kill_udevd > "$udev_root/null" 2>&1
 
-scsi_replay > "$udev_root/null" 2>&1
-
-ret=$(( $ret + $? ))
-
-ide_scan > "$udev_root/null" 2>&1
-
-# Starting the hotplug events dispatcher
-/sbin/udevd --daemon
-
-# Making extra nodes
-make_extra_nodes
-
-# Setting default hotplug handler
-set_hotplug_handler
-
-# Synthesizing the initial hotplug events
-/sbin/${UDEV_STARTER}
-
-# wait for /dev to be fully populated
-while [ -d /dev/.udev/queue/ ]; do
-    sleep 0.2
-    udevd_timeout=$(($udevd_timeout - 1))
-    if [ $udevd_timeout -eq 0 ]; then
-	break
-    fi
-done
-
-# Start workaround for broken Linux input subsystem
-/lib/udev/udev_input_coldplug start
-
+if [ -f "/sys/class/tty/console/uevent" ]; then
+	# Start udevd daemon
+	udevd -d
+	
+        # Making extra nodes
+	make_extra_nodes
+	
+        # Setting default hotplug handler
+	set_hotplug_handler
+else
+    echo "udev requires a kernel >= 2.6.15, not started."
+    exit 0                                                
+fi
 ret=$(( $ret + $? ))
 [ $ret -eq 0 ] && ok || fail
 exit 0
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/start_udev?r1=1.29&r2=1.30&f=u



More information about the pld-cvs-commit mailing list