Skip to contentSkip to conversation

init.d script for debian

PATCH John L. Fjellstad 3 participants 3 messages Feb 17, 2004

lore
Share & tools
lore
#0 lore raw

The /dev/null node gets removed to early, so than any subsequent removal gets an error message about missing /dev/null. I moved the removal of /dev/null to last, and added the previous patch

Signature · 2 lines
John L. Fjellstad
web: http://www.fjellstad.org/          Quis custodiet ipsos custodes
udev.debian renamed from udev.debian.orig +20 -1
@@ -45,6 +45,12 @@
 	# all other device classes
 	for i in ${sysfs_dir}/class/*; do
 		for j in $i/*; do
+			if [ $ACTION == "remove" ]; then
+				if [ $j == "${sysfs_dir}/class/mem/null" ]; then
+				
+					continue;
+				fi
+			fi
 			if [ -f $j/dev ]; then
 				export DEVPATH=${j#${sysfs_dir}}
 				CLASS=`echo ${i#${sysfs_dir}} | \
@@ -53,6 +59,12 @@
 			fi
 		done
 	done
+
+	if [ $ACTION == "remove" ]; then
+		export DEVPATH=/class/mem/null;
+		CLASS=mem;
+		$bin $CLASS &
+	fi
 }
 
 
@@ -61,13 +73,18 @@
 	if [ ! -d $udev_dir ]; then
 		mkdir $udev_dir
 	fi
-	if [ ! -d $sysfs_dir ]; then
+	# don't use udev if sysfs is not mounted
+	if [ ! -d $sysfs_dir/block ]; then
 		exit 1
 	fi
 	# propogate /udev from /sys - we only need this while we do not
 	# have initramfs and an early user-space with which to do early
 	# device bring up
 	action "Creating initial udev device nodes: " /bin/true
+	if [ ! -c $udev_dir/null ]; then
+		action "Creating initial ${udev_dir}/null" /bin/true
+		/bin/mknod ${udev_dir}/null c 1 3
+	fi
 	export ACTION=add
 	run_udev 
 
@@ -78,6 +95,7 @@
 	cd $udev_dir && ln -s fd/2 stderr
 	cd $udev_dir && ln -s /proc/kcore core
 	cd $udev_dir && ln -s /proc/asound/oss/sndstat sndstat
+
 	;;
   stop)
   	# be careful
@@ -90,6 +108,7 @@
 	rm -f $udev_dir/stdout
 	rm -f $udev_dir/stdin
 	rm -f $udev_dir/fd
+	rm -f $udev_dir/memstick1
 	;;
   status)
   	if [ -d $udev_dir ]; then
#1 lore raw
Quoted 3 lines · John L. Fjellstad

The /dev/null node gets removed to early, so than any subsequent removal gets an error message about missing /dev/null. I moved the removal of /dev/null to last, and added the previous patch

Why remove it at all? It's not like its major/minor numbers are going to change soon.

Signature · 2 lines
ciao, |
Marco | [4643 avnRuImWtqx66]
#2 lore raw
In reply to John L. Fjellstad
Quoted 7 lines · Marco d'Itri
Quoted 3 lines · John L. Fjellstad

The /dev/null node gets removed to early, so than any subsequent removal gets an error message about missing /dev/null. I moved the removal of /dev/null to last, and added the previous patch

Why remove it at all? It's not like its major/minor numbers are going to change soon.

Not yet, but in 2.7 it might... :)

thanks,

greg k-h

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel