[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

patch for mkinitrd to use /proc/self/fd



[ CCing to debian-kernel to see what people think. ]

In case this bug gets reassigned to initrd-tools here's a patch for
mkinitrd that also makes sense. It'll now try /dev/fd, then
/proc/self/fd, then bail.

For those just joining us: MAKEDEV doesn't create /dev/fd on sparc,
initrd-tools cries a river when it can just use /proc/self/fd. So which
is broken, makedev or initrd-tools?

-- 
Joshua Kwan
diff -urN bah/initrd-tools-0.1.71/mkinitrd initrd-tools-0.1.71/mkinitrd
--- bah/initrd-tools-0.1.71/mkinitrd	2004-07-01 08:02:43.000000000 -0700
+++ initrd-tools-0.1.71/mkinitrd	2004-07-06 11:53:51.000000000 -0700
@@ -1190,10 +1190,15 @@
 ROOT=${croot-$ROOT}
 MKIMAGE=${cmkimage-$MKIMAGE}
 
-[ -d /dev/fd ] || {
-	echo "$PROG: /dev/fd does not exist" >&2
+if [ -d /dev/fd ]; then
+	FD=/dev/fd
+elif [ -d /proc/self/fd ]; then
+	FD=/proc/self/fd
+else
+	echo "$PROG: neither /dev/fd or /proc/self/fd exists!" >&2
+	echo "Try mounting the proc filesystem: mount -tproc none /proc" >&2
 	exit 1
-}
+fi
 
 DSIG=
 exittrap='if [ $DSIG ]; then trap - "$DSIG"; kill -s $DSIG $$; fi'
@@ -1219,4 +1224,4 @@
 
 umask "$UMASK"
 gendir $workdir
-eval "$(printf "$MKIMAGE" $workdir/initrd /dev/fd/3)" 3>&1 >&2
+eval "$(printf "$MKIMAGE" $workdir/initrd $FD/3)" 3>&1 >&2

Attachment: signature.asc
Description: Digital signature


Reply to: