rootskel: script to add Netwinder udev rule
Does anyone have comments regarding the patch below before I commit
it? (Thanks to Frans and Marco for some help.)
Index: src/lib/debian-installer-startup.d/S02netwinder-net
===================================================================
--- src/lib/debian-installer-startup.d/S02netwinder-net (revision 0)
+++ src/lib/debian-installer-startup.d/S02netwinder-net (revision 0)
@@ -0,0 +1,28 @@
+# Install a udev rule on Netwinder machines to make sure the network
+# interfaces receive the same names as used by the firmware.
+
+if [ "$(archdetect)" != "arm/netwinder" ]; then
+ exit 0
+fi
+
+cat > /etc/udev/rules.d/71-netwinder_net.rules <<EOF
+# Make sure Linux uses the same names for network interfaces as the
+# Netwinder firmware. This rules file was created by the Debian
+# installer.
+
+SUBSYSTEM=="net", DRIVERS=="ne2k-pci", NAME="eth0"
+SUBSYSTEM=="net", DRIVERS=="tulip", NAME="eth1"
+EOF
+
+# Create a base-installer.d script to copy this rules file to the target
+cat > /usr/lib/base-installer.d/06udev-netwinder-net << EOF
+#!/bin/sh -e
+
+RULESDIR=etc/udev/rules.d
+
+mkdir -p /target/\$RULESDIR
+cp /\$RULESDIR/71-netwinder_net.rules /target/\$RULESDIR 2>/dev/null || true
+EOF
+
+chmod +x /usr/lib/base-installer.d/06udev-netwinder-net
+
Index: src/lib/debian-installer-startup.d/Makefile
===================================================================
--- src/lib/debian-installer-startup.d/Makefile (revision 49940)
+++ src/lib/debian-installer-startup.d/Makefile (working copy)
@@ -46,6 +46,12 @@
S40framebuffer-module-linux-alpha \
S04countcpus-linux-alpha
endif
+
+ ifneq (,$(filter arm,$(DEB_HOST_ARCH_CPU)))
+ files += \
+ S02netwinder-net
+ endif
+
endif
include ../../../Makefile.inc
--
Martin Michlmayr
http://www.cyrius.com/
Reply to: