debnet: Ignore loop devices
authorMichael Prokop <mika@grml.org>
Sun, 13 May 2012 15:57:10 +0000 (17:57 +0200)
committerMichael Prokop <mika@grml.org>
Sun, 13 May 2012 15:57:10 +0000 (17:57 +0200)
Quoting from http://bts.grml.org/grml/issue1166:

| I booted using the options lvm debnet, expecting debnet to use the
| /etc/network/interfaces file from the LVM logical volume. Instead, it
| used the /etc/network/interfaces file from /dev/loop0, because that is
| listed earlier in /proc/partitions.

Thanks: John S. Skogtvedt <jss@bzz.no> for bugreport and patch

sbin/debnet

index 683b475..e1e811f 100755 (executable)
@@ -16,7 +16,7 @@ if [ "$1" = "-h" -o "$1" = "--help" ] ; then
    exit 0
 fi
 
-DEVICES="$(< /proc/partitions tail -n +3 | awk '{print "/dev/"$4}' | tr "\n" " ")"
+DEVICES="$(< /proc/partitions tail -n +3 | awk '($4 !~ /loop[0-9]+/) {print "/dev/"$4}' | tr "\n" " ")"
 DEVICES="$DEVICES $(ls /dev/mapper/*)"
 FOUND_DEBNET=""