[Pkg-utopia-maintainers] Bug#606268: Bug#606268: Debdiff with new script to handle /etc/network/interfaces

Maximiliano Curia maxy at debian.org
Thu Nov 29 23:00:58 UTC 2012


¡Hola Michael!

El 2012-11-29 a las 04:09 +0100, Michael Biebl escribió:
> What makes this a bit more complicated, is that you can use a syntax
> like this:
 
> auto eth0 eth1
 
> iface eth0 inet manual
> iface eth1 inet dhcp
 
> In this case you can't simply comment out the auto line, since that
> would disable eth0.
 
> Would be great if you can update your patch accordingly.

Done. It was a little more complex than expected.

I'm attaching the updated patch.

-- 
"There are only two things wrong with C++: The initial concept and the
implementation."
-- Bertrand Meyer
Saludos /\/\ /\ >< `/
-------------- next part --------------
diff -Nru network-manager-0.9.4.0/debian/changelog network-manager-0.9.4.0/debian/changelog
--- network-manager-0.9.4.0/debian/changelog	2012-09-11 19:24:44.000000000 +0200
+++ network-manager-0.9.4.0/debian/changelog	2012-11-29 14:22:54.000000000 +0100
@@ -1,3 +1,16 @@
+network-manager (0.9.4.0-6.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * debian/ifblacklist_migrate.sh: Replace if blacklist script to manage more
+    complex cases of /etc/network/interfaces.
+    (Closes: #606268, #688355, #690987)
+  * debian/rules: Add test cases for if blacklist scripts.
+  * debian/network-manager.postrm: Update sed call to remove lines added by
+    ifblacklist_migrate.sh.
+  * debian/tests/*: Test cases.
+
+ -- Maximiliano Curia <maxy at debian.org>  Thu, 29 Nov 2012 14:22:38 +0100
+
 network-manager (0.9.4.0-6) unstable; urgency=low
 
   * debian/rules: Use xz compression for binary packages.
diff -Nru network-manager-0.9.4.0/debian/ifblacklist_migrate.sh network-manager-0.9.4.0/debian/ifblacklist_migrate.sh
--- network-manager-0.9.4.0/debian/ifblacklist_migrate.sh	2012-09-11 19:24:44.000000000 +0200
+++ network-manager-0.9.4.0/debian/ifblacklist_migrate.sh	2012-11-29 23:44:33.000000000 +0100
@@ -1,66 +1,241 @@
 #!/bin/sh
 
-# (C) 2007 Canonical Ltd.
-# Author: Alexander Sack <asac at jwsdot.com>
+# (C) 2012 Debian
+# Author: Maximiliano Curia <maxy at debian.org>
 # License: GNU General Public License, version 2 or any later version
 
-if test x$NIF_FILE = x; then
+if [ -z "$NIF_FILE" ]; then
    NIF_FILE=/etc/network/interfaces
 fi
 
-auto_ifs=$(cat $NIF_FILE | \
-    egrep "^auto|^allow-" | \
-    sed -e 's/auto//' | \
-    sed -e 's/allow-[^ ].* //')
-
-ifaces_to_disable=""
-
-echo Auto interfaces found: $auto_ifs
-
-# iterate over all auto interfaces
-for i in $auto_ifs; do
-  IFS_old=$IFS; IFS=""
-
-  NIF_FILE_content=$(cat $NIF_FILE | \
-      sed -e 's/^[ \t]*auto.*$//' | \
-      sed -e 's/^[ \t]*allow-.*$//' | \
-      sed -e 's/^[ \t]*#.*$//' | grep -v ^$)
-
-  # '--' is inserted by grep -A1 if there are multiple iface blocks
-  lines=$(echo $NIF_FILE_content | grep -A1 "^iface.*$i.*dhcp" | grep -v '\--')
-  IFS="
-"
-
-  # if there is no iface line for that interface, we would still get a line
-  # count of 1 ... so use word_count 0 below to exclude ifaces that have no
-  # configuration at all.
-  word_count=$(echo $lines | wc -w)
-  line_count=0
-  for line in $lines; do
-      nulled_line=$(echo "$line" | sed -e 's/[# ]//' | grep -v ^iface)
-      if test x$nulled_line != x; then
-	  line_count=$(expr $line_count + 1)
-      fi
-  done
-
-  if test $line_count -eq 0 -a $word_count -gt 0; then
-     ifaces_to_disable="$ifaces_to_disable $i"
-     echo iface to disable = $i
-  fi
-  IFS=$IFS_old
-done
+# Parse interfaces file, generates the sed commands to comment or edit lines
+sed_commands=$(awk '
+BEGIN {
+	# 0: NONE
+	# 1: iface
+	# 2: mapping
+	cur = 0;
+	buffer = "";
+	# line_ns will contain a key for each line in the buffer
+	# ifaces is an array with all the lines associated with each interface
+	name = "";
+	family = "";
+	method = "";
+}
+
+function lstrip(s)
+{
+	if (match(s, /^[[:space:]]+/)) {
+		return substr(s, RLENGTH + 1);
+	}
+	return s;
+}
+
+function rstrip(s)
+{
+	if (match(s, /[[:space:]]+$/)) {
+		return substr(s, 1, RSTART - 1);
+	}
+	return s;
+}
+
+# Pseudo lists in awk are strings with elements separated by SUBSEP
+
+# appends element to list
+function append(list, element, sep)
+{
+	if (list) {
+		return list sep element;
+	} else {
+		return element;
+	}
+}
+
+# removes element from list
+function remove(list, element, sep)
+{
+	n = split(list, a, sep);
+	out = "";
+	for (i = 1; i <= n; i++) {
+		if (element != a[i]) {
+			out = append(out, a[i], sep);
+		}
+	}
+	return out;
+}
+
+function process(line, line_ns)
+{
+	words_len = split(line, words);
+	if (words[1] == "mapping") {
+		if (words_len < 2) { # invalid iface entry, skip it
+			cur = 0;
+			return;
+		}
+		cur = 2;
+		name = words[2];
+		mappings[name] = 1;
+	} else if (words[1] == "source") {
+		# Not supported by this script, only used to detect end of blocks
+		cur = 0;
+	} else if (words[1] == "iface") {
+		if (words_len < 4) { # invalid iface entry, skip it
+			cur = 0;
+			return;
+		}
+		cur = 1;
+		name = words[2];
+		family = words[3];
+		method = words[4];
+
+		# Mark unsupported families and methods
+		if ((family != "inet") && (family != "inet6")) {
+			unsupported[name] = 1;
+		}
+		if ((method != "dhcp") && (method != "auto")) {
+			unsupported[name] = 1;
+		}
+	} else if ((words[1] == "auto") || (words[1] ~ /^allow-/)) {
+		cur = 0;
+		# Iterate over the line numbers associated to the buffer
+		for (line_no in line_ns) {
+			# Store the first word for future use
+			text[line_no] = words[1];
+
+			for (i = 2; i <= words_len; i++) {
+				# if it is an inline comment, skip the rest of the line
+				if (words[i] ~ /^#/) break;
+
+				name = words[i];
+				ifaces_defs[name] = append(ifaces_defs[name], line_no, SUBSEP);
+				text[line_no] = append(text[line_no], name, SUBSEP);
+			}
+		}
+	}
+	if (cur == 1) {
+		# NetworkManager does not handle bonds nor bridges
+		if ((words[1] == "slaves") || (words[1] == "bridge_ports")) {
+			unsupported[name] = 1;
+		}
+		for (line_no in line_ns) {
+			ifaces[name, family, method, line_no] = 1;
+		}
+	}
+}
+
+# This block processes each line in the file
+{
+	if (NF == 0) {
+	    # blank line
+	} else if ($1 ~ /^#/) {
+	    # comment
+	} else {
+	    line = lstrip($0);
+	    if (match(line, /\\$/)) {
+	    	# continued line
+			gsub(/\\$/, " ", line);
+	        buffer = buffer line;
+			# store the line number to be processed later
+			line_ns[FNR] = 1;
+	    } else {
+	    	# normal  line, add to buffer and process it
+	        buffer = rstrip(buffer line);
+			# store the line number to be processed later
+			line_ns[FNR] = 1;
+			# process the buffer
+			process(buffer, line_ns);
+			buffer = "";
+			delete line_ns;
+		}
+	}
+}
+
+END {
+	for (key in ifaces) {
+		split(key, a, SUBSEP);
+		name    = a[1];
+		family  = a[2];
+		method  = a[3];
+		line_no = a[4];
+		b_len = split(name, b, "-");
+		if ((b_len > 1) && (b[1] in mappings)) {
+			continue;
+		}
+		if (name in unsupported) {
+			continue;
+		}
+		lines_to_comment[name] = append(lines_to_comment[name], line_no, SUBSEP);
+	}
+	for (name in ifaces_defs) {
+		# Check for configurations block not managed by this script, if the
+		# interface is a mapping we would let the admin to manage it.
+		if ((name in unsupported) || (name in mappings)) {
+			delete lines_to_comment[name];
+			continue;
+		}
+
+		# Remove commented interfaces from the "auto" lines
+		n = split(ifaces_defs[name], lines, SUBSEP);
+		for (i = 1; i <= n; i++) {
+			line_no = lines[i];
+			text[line_no] = remove(text[line_no], name, SUBSEP);
+			len = split(text[line_no], aux, SUBSEP);
+			if (len <= 1) {
+				lines_to_comment[name] = append(lines_to_comment[name], line_no, SUBSEP);
+				delete text[line_no];
+			}
+		}
+	}
+
+	# Generate "auto" lines when necessary
+	for (name in ifaces_defs) {
+		if ((name in unsupported) || (name in mappings)) {
+			continue;
+		}
+		n = split(ifaces_defs[name], lines, SUBSEP);
+		for (i = 1; i <= n; i++) {
+			line_no = lines[i];
+			if (!(line_no in text)) continue;
+
+			gsub(SUBSEP, " ", text[line_no]);
+			add_lines[text[line_no]] = 1;
+			comment_lines[line_no] = 1;
+		}
+	}
+	for (name in lines_to_comment) {
+		n = split(lines_to_comment[name], lines, SUBSEP);
+		for (i = 1; i <= n; i++) {
+			print lines[i] "s/^/#NetworkManager#/;";
+		}
+	}
+	for (line_no in comment_lines) {
+		print line_no "s/^/#NetworkManager#/;";
+	}
+	for (line in add_lines) {
+		print "$a \\\n" line " #NetworkManager#";
+	}
+}
+' "$NIF_FILE")
+
+if [ -z "$sed_commands" ]; then
+	# nothing to do
+	exit 0
+fi
 
+# Find the first unused .bak-# and backup
 backup_suffix=0
-while test -e ${NIF_FILE}.bak-${backup_suffix}; do
+while [ -e "${NIF_FILE}.bak-${backup_suffix}" ]; do
    backup_suffix=$(expr $backup_suffix + 1)
 done
 
-if [ -n "$ifaces_to_disable" ]; then
-    cp $NIF_FILE "$NIF_FILE.bak-${backup_suffix}"
-    for i in $ifaces_to_disable; do
-	echo -n "Disabling interface: $i ... "
-	sed -i -e "s/^\([ \t]*iface.*[ \t]$i[ \t].*\)$/#NetworkManager#\1/" $NIF_FILE
-	echo done.
-    done
-fi
+cp "$NIF_FILE" "$NIF_FILE.bak-${backup_suffix}"
 
+echo -n "Disabling dhcp and auto interfaces: "
+sed -i -e "$sed_commands" "$NIF_FILE"
+if [ $? -ne 0 ]; then
+	echo -n "failed. Reverting changes."
+	mv "$NIF_FILE.bak-${backup_suffix}" "$NIF_FILE"
+	echo " Please edit $NIF_FILE manually."
+else
+	echo "done."
+fi
diff -Nru network-manager-0.9.4.0/debian/network-manager.postrm network-manager-0.9.4.0/debian/network-manager.postrm
--- network-manager-0.9.4.0/debian/network-manager.postrm	2012-09-11 19:24:44.000000000 +0200
+++ network-manager-0.9.4.0/debian/network-manager.postrm	2012-11-29 14:19:36.000000000 +0100
@@ -33,7 +33,9 @@
             backup_suffix=$(($backup_suffix + 1))
         done
         if [ -f /etc/network/interfaces ]; then
-            sed -i.bak-${backup_suffix} -e "s/^#NetworkManager#//g" /etc/network/interfaces
+            sed -i.bak-${backup_suffix} \
+				-e 's/^#NetworkManager#//g;/#NetworkManager#$/d' \
+				/etc/network/interfaces
         fi
         ;;
     upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
diff -Nru network-manager-0.9.4.0/debian/rules network-manager-0.9.4.0/debian/rules
--- network-manager-0.9.4.0/debian/rules	2012-09-11 19:24:44.000000000 +0200
+++ network-manager-0.9.4.0/debian/rules	2012-11-28 21:46:03.000000000 +0100
@@ -3,6 +3,12 @@
 DPKG_EXPORT_BUILDFLAGS = 1
 include /usr/share/dpkg/buildflags.mk
 
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+  RUN_TESTS := yes
+else
+  RUN_TESTS :=
+endif
+
 %:
 	dh $@
 
@@ -44,3 +50,13 @@
 	dh_builddeb -- -Zxz
 
 override_dh_auto_test:
+ifeq ($(RUN_TESTS),yes)
+	$(MAKE) -C debian/tests
+endif
+
+override_dh_auto_clean:
+	dh_auto_clean
+ifeq ($(RUN_TESTS),yes)
+	$(MAKE) -C debian/tests clean
+endif
+
diff -Nru network-manager-0.9.4.0/debian/tests/if-000.in network-manager-0.9.4.0/debian/tests/if-000.in
--- network-manager-0.9.4.0/debian/tests/if-000.in	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-000.in	2012-11-29 23:40:11.000000000 +0100
@@ -0,0 +1,28 @@
+# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
+
+# The loopback interface
+
+auto lo
+iface lo inet loopback
+name Loopback: Virtual interface
+
+#auto eth0
+##iface eth0 inet dhcp
+#iface eth0 inet static
+#    address 192.168.2.11
+#    netmask 255.255.255.0
+#    gateway 192.168.2.1
+#    dns-nameservers 192.168.2.1
+#    dns-search example.com
+#    dns-domain example.com
+#    post-up /sbin/ethtool -s $IFACE wol g
+#    post-down /sbin/ethtool -s $IFACE wol g
+#name Ethernet card
+#
+#allow-hotplug usb0
+#
+#iface usb0 inet static
+#    address 192.168.111.2
+#    netmask 255.255.255.0
+
+
diff -Nru network-manager-0.9.4.0/debian/tests/if-000.in.bak-0 network-manager-0.9.4.0/debian/tests/if-000.in.bak-0
--- network-manager-0.9.4.0/debian/tests/if-000.in.bak-0	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-000.in.bak-0	2012-11-29 23:39:39.000000000 +0100
@@ -0,0 +1,28 @@
+# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
+
+# The loopback interface
+
+auto lo
+iface lo inet loopback
+name Loopback: Virtual interface
+
+#auto eth0
+##iface eth0 inet dhcp
+#iface eth0 inet static
+#    address 192.168.2.11
+#    netmask 255.255.255.0
+#    gateway 192.168.2.1
+#    dns-nameservers 192.168.2.1
+#    dns-search example.com
+#    dns-domain example.com
+#    post-up /sbin/ethtool -s $IFACE wol g
+#    post-down /sbin/ethtool -s $IFACE wol g
+#name Ethernet card
+#
+#allow-hotplug usb0
+#
+#iface usb0 inet static
+#    address 192.168.111.2
+#    netmask 255.255.255.0
+
+
diff -Nru network-manager-0.9.4.0/debian/tests/if-000.out network-manager-0.9.4.0/debian/tests/if-000.out
--- network-manager-0.9.4.0/debian/tests/if-000.out	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-000.out	2012-11-28 21:51:09.000000000 +0100
@@ -0,0 +1,28 @@
+# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
+
+# The loopback interface
+
+auto lo
+iface lo inet loopback
+name Loopback: Virtual interface
+
+#auto eth0
+##iface eth0 inet dhcp
+#iface eth0 inet static
+#    address 192.168.2.11
+#    netmask 255.255.255.0
+#    gateway 192.168.2.1
+#    dns-nameservers 192.168.2.1
+#    dns-search example.com
+#    dns-domain example.com
+#    post-up /sbin/ethtool -s $IFACE wol g
+#    post-down /sbin/ethtool -s $IFACE wol g
+#name Ethernet card
+#
+#allow-hotplug usb0
+#
+#iface usb0 inet static
+#    address 192.168.111.2
+#    netmask 255.255.255.0
+
+
diff -Nru network-manager-0.9.4.0/debian/tests/if-001.in network-manager-0.9.4.0/debian/tests/if-001.in
--- network-manager-0.9.4.0/debian/tests/if-001.in	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-001.in	2012-11-28 21:29:51.000000000 +0100
@@ -0,0 +1,14 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# The primary network interface
+allow-hotplug eth0
+iface eth0 inet dhcp
+# This is an autoconfigured IPv6 interface
+iface eth0 inet6 manual
+	up ip link set eth0 up
+	down ip link set eth0 down
diff -Nru network-manager-0.9.4.0/debian/tests/if-001.out network-manager-0.9.4.0/debian/tests/if-001.out
--- network-manager-0.9.4.0/debian/tests/if-001.out	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-001.out	2012-11-29 14:11:59.000000000 +0100
@@ -0,0 +1,14 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# The primary network interface
+allow-hotplug eth0
+iface eth0 inet dhcp
+# This is an autoconfigured IPv6 interface
+iface eth0 inet6 manual
+	up ip link set eth0 up
+	down ip link set eth0 down
diff -Nru network-manager-0.9.4.0/debian/tests/if-002.in network-manager-0.9.4.0/debian/tests/if-002.in
--- network-manager-0.9.4.0/debian/tests/if-002.in	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-002.in	2012-11-28 21:29:51.000000000 +0100
@@ -0,0 +1,16 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# The primary network interface
+allow-hotplug eth0
+iface eth0 inet dhcp
+# This is an autoconfigured IPv6 interface
+iface eth0 inet6 auto
+	# Activate RFC 4941 privacy extensions for outgoing connections. The
+	# machine will still be reachable via its EUI-64 interface identifier.
+	privext 2
+
diff -Nru network-manager-0.9.4.0/debian/tests/if-002.out network-manager-0.9.4.0/debian/tests/if-002.out
--- network-manager-0.9.4.0/debian/tests/if-002.out	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-002.out	2012-11-29 14:12:31.000000000 +0100
@@ -0,0 +1,16 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# The primary network interface
+#NetworkManager#allow-hotplug eth0
+#NetworkManager#iface eth0 inet dhcp
+# This is an autoconfigured IPv6 interface
+#NetworkManager#iface eth0 inet6 auto
+	# Activate RFC 4941 privacy extensions for outgoing connections. The
+	# machine will still be reachable via its EUI-64 interface identifier.
+#NetworkManager#	privext 2
+
diff -Nru network-manager-0.9.4.0/debian/tests/if-003.in network-manager-0.9.4.0/debian/tests/if-003.in
--- network-manager-0.9.4.0/debian/tests/if-003.in	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-003.in	2012-11-28 21:29:51.000000000 +0100
@@ -0,0 +1,6 @@
+# The primary network interface
+allow-hotplug wlan0
+iface wlan0 inet dhcp
+        # wireless-* options are implemented by the wireless-tools package
+        wireless-mode managed
+	wireless-essid any
diff -Nru network-manager-0.9.4.0/debian/tests/if-003.out network-manager-0.9.4.0/debian/tests/if-003.out
--- network-manager-0.9.4.0/debian/tests/if-003.out	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-003.out	2012-11-29 14:12:59.000000000 +0100
@@ -0,0 +1,6 @@
+# The primary network interface
+#NetworkManager#allow-hotplug wlan0
+#NetworkManager#iface wlan0 inet dhcp
+        # wireless-* options are implemented by the wireless-tools package
+#NetworkManager#        wireless-mode managed
+#NetworkManager#	wireless-essid any
diff -Nru network-manager-0.9.4.0/debian/tests/if-004.in network-manager-0.9.4.0/debian/tests/if-004.in
--- network-manager-0.9.4.0/debian/tests/if-004.in	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-004.in	2012-11-28 21:29:51.000000000 +0100
@@ -0,0 +1,10 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# The primary network interface
+allow-hotplug eth0
+#NetworkManager#iface eth0 inet dhcp
diff -Nru network-manager-0.9.4.0/debian/tests/if-004.out network-manager-0.9.4.0/debian/tests/if-004.out
--- network-manager-0.9.4.0/debian/tests/if-004.out	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-004.out	2012-11-29 14:13:18.000000000 +0100
@@ -0,0 +1,10 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# The primary network interface
+#NetworkManager#allow-hotplug eth0
+#NetworkManager#iface eth0 inet dhcp
diff -Nru network-manager-0.9.4.0/debian/tests/if-005.in network-manager-0.9.4.0/debian/tests/if-005.in
--- network-manager-0.9.4.0/debian/tests/if-005.in	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-005.in	2012-11-28 21:29:51.000000000 +0100
@@ -0,0 +1,68 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+allow-hotplug usb0
+
+iface usb0 inet static
+    address 192.168.111.2
+    netmask 255.255.255.0
+
+#auto eth0
+#iface eth0 inet static
+#	address 192.168.20.80
+#	netmask 255.255.255.0
+
+# The primary network interface
+allow-hotplug eth0
+iface eth0 inet dhcp
+
+allow-hotplug wlan0
+#iface wlan0 inet dhcp
+
+mapping wlan0
+	script ifscheme-mapping
+
+iface wlan0-test0 inet dhcp
+#iface wlan0 inet dhcp
+	wpa-driver wext
+	wpa-ssid test0
+	wpa-ap-scan 1
+	wpa-proto RSN
+	wpa-pairwise CCMP
+	wpa-group CCMP
+	wpa-key-mgmt WPA-PSK
+	wireless-txpower 42mW
+	wireless-rate auto
+#	wireless-essid test0
+#	wireless-channel 11
+#	wireless-defaultkey 1
+
+iface wlan0-test1 inet dhcp
+	wireless-essid test1
+	wireless-channel 9
+	wireless-defaultkey 1
+	wireless-ap 00:0E:8E:02:84:58
+
+iface wlan0-test2 inet dhcp
+	wireless-essid test2
+	wireless-defaultkey 1
+	wireless-ap auto
+	wireless-txpower 42mW
+
+iface wlan0-test3 inet dhcp
+	wpa-driver wext
+	wpa-ssid Test3
+	wpa-ap-scan 1
+	wpa-proto RSN
+	wpa-pairwise CCMP
+	wpa-group CCMP
+	wpa-key-mgmt WPA-PSK
+
+iface wlan0-default inet dhcp
+	wireless-ap auto
+	wireless-txpower 42mW
+
diff -Nru network-manager-0.9.4.0/debian/tests/if-005.out network-manager-0.9.4.0/debian/tests/if-005.out
--- network-manager-0.9.4.0/debian/tests/if-005.out	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-005.out	2012-11-29 14:13:48.000000000 +0100
@@ -0,0 +1,68 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+allow-hotplug usb0
+
+iface usb0 inet static
+    address 192.168.111.2
+    netmask 255.255.255.0
+
+#auto eth0
+#iface eth0 inet static
+#	address 192.168.20.80
+#	netmask 255.255.255.0
+
+# The primary network interface
+#NetworkManager#allow-hotplug eth0
+#NetworkManager#iface eth0 inet dhcp
+
+allow-hotplug wlan0
+#iface wlan0 inet dhcp
+
+mapping wlan0
+	script ifscheme-mapping
+
+iface wlan0-test0 inet dhcp
+#iface wlan0 inet dhcp
+	wpa-driver wext
+	wpa-ssid test0
+	wpa-ap-scan 1
+	wpa-proto RSN
+	wpa-pairwise CCMP
+	wpa-group CCMP
+	wpa-key-mgmt WPA-PSK
+	wireless-txpower 42mW
+	wireless-rate auto
+#	wireless-essid test0
+#	wireless-channel 11
+#	wireless-defaultkey 1
+
+iface wlan0-test1 inet dhcp
+	wireless-essid test1
+	wireless-channel 9
+	wireless-defaultkey 1
+	wireless-ap 00:0E:8E:02:84:58
+
+iface wlan0-test2 inet dhcp
+	wireless-essid test2
+	wireless-defaultkey 1
+	wireless-ap auto
+	wireless-txpower 42mW
+
+iface wlan0-test3 inet dhcp
+	wpa-driver wext
+	wpa-ssid Test3
+	wpa-ap-scan 1
+	wpa-proto RSN
+	wpa-pairwise CCMP
+	wpa-group CCMP
+	wpa-key-mgmt WPA-PSK
+
+iface wlan0-default inet dhcp
+	wireless-ap auto
+	wireless-txpower 42mW
+
diff -Nru network-manager-0.9.4.0/debian/tests/if-006.in network-manager-0.9.4.0/debian/tests/if-006.in
--- network-manager-0.9.4.0/debian/tests/if-006.in	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-006.in	2012-11-28 21:57:34.000000000 +0100
@@ -0,0 +1,12 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# The primary network interface
+#auto eth0
+#iface eth0 inet dhcp
+# This is an autoconfigured IPv6 interface
+#iface eth0 inet6 auto
diff -Nru network-manager-0.9.4.0/debian/tests/if-006.out network-manager-0.9.4.0/debian/tests/if-006.out
--- network-manager-0.9.4.0/debian/tests/if-006.out	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-006.out	2012-11-28 21:55:46.000000000 +0100
@@ -0,0 +1,12 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# The primary network interface
+#auto eth0
+#iface eth0 inet dhcp
+# This is an autoconfigured IPv6 interface
+#iface eth0 inet6 auto
diff -Nru network-manager-0.9.4.0/debian/tests/if-007.in network-manager-0.9.4.0/debian/tests/if-007.in
--- network-manager-0.9.4.0/debian/tests/if-007.in	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-007.in	2012-11-28 21:59:38.000000000 +0100
@@ -0,0 +1,11 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# eth0 is the ethernet card
+auto eth0
+iface eth0 inet dhcp
+# network-manager
diff -Nru network-manager-0.9.4.0/debian/tests/if-007.out network-manager-0.9.4.0/debian/tests/if-007.out
--- network-manager-0.9.4.0/debian/tests/if-007.out	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-007.out	2012-11-29 14:14:08.000000000 +0100
@@ -0,0 +1,11 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# eth0 is the ethernet card
+#NetworkManager#auto eth0
+#NetworkManager#iface eth0 inet dhcp
+# network-manager
diff -Nru network-manager-0.9.4.0/debian/tests/if-008.in network-manager-0.9.4.0/debian/tests/if-008.in
--- network-manager-0.9.4.0/debian/tests/if-008.in	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-008.in	2012-11-28 22:01:02.000000000 +0100
@@ -0,0 +1,20 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# The primary network interface
+auto eth0
+iface eth0 inet manual
+
+auto br0
+iface br0 inet dhcp
+	bridge_ports eth0
+	bridge_stp off
+	bridge_fd 0
+
+#iface eth0 inet dhcp
+# This is an autoconfigured IPv6 interface
+#iface eth0 inet6 auto
diff -Nru network-manager-0.9.4.0/debian/tests/if-008.out network-manager-0.9.4.0/debian/tests/if-008.out
--- network-manager-0.9.4.0/debian/tests/if-008.out	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-008.out	2012-11-29 14:14:38.000000000 +0100
@@ -0,0 +1,20 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# The primary network interface
+auto eth0
+iface eth0 inet manual
+
+auto br0
+iface br0 inet dhcp
+	bridge_ports eth0
+	bridge_stp off
+	bridge_fd 0
+
+#iface eth0 inet dhcp
+# This is an autoconfigured IPv6 interface
+#iface eth0 inet6 auto
diff -Nru network-manager-0.9.4.0/debian/tests/if-009.in network-manager-0.9.4.0/debian/tests/if-009.in
--- network-manager-0.9.4.0/debian/tests/if-009.in	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-009.in	2012-11-29 13:50:13.000000000 +0100
@@ -0,0 +1,3 @@
+auto eth0 eth1
+iface eth0 inet manual                                                                                                                             
+iface eth1 inet dhcp
diff -Nru network-manager-0.9.4.0/debian/tests/if-009.out network-manager-0.9.4.0/debian/tests/if-009.out
--- network-manager-0.9.4.0/debian/tests/if-009.out	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-009.out	2012-11-29 14:15:13.000000000 +0100
@@ -0,0 +1,4 @@
+#NetworkManager#auto eth0 eth1
+iface eth0 inet manual                                                                                                                             
+#NetworkManager#iface eth1 inet dhcp
+auto eth0 #NetworkManager#
diff -Nru network-manager-0.9.4.0/debian/tests/if-010.in network-manager-0.9.4.0/debian/tests/if-010.in
--- network-manager-0.9.4.0/debian/tests/if-010.in	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-010.in	2012-11-29 13:58:34.000000000 +0100
@@ -0,0 +1,10 @@
+auto bond0
+iface bond0 inet dhcp
+    # mtu 9000
+    slaves eth0 eth1 eth2 eth3
+    # bond_mode balance-rr
+    bond_mode 802.3ad
+    bond_miimon    200
+    bond_downdelay 600
+    bond_updelay   600
+
diff -Nru network-manager-0.9.4.0/debian/tests/if-010.out network-manager-0.9.4.0/debian/tests/if-010.out
--- network-manager-0.9.4.0/debian/tests/if-010.out	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/if-010.out	2012-11-29 14:11:26.000000000 +0100
@@ -0,0 +1,10 @@
+auto bond0
+iface bond0 inet dhcp
+    # mtu 9000
+    slaves eth0 eth1 eth2 eth3
+    # bond_mode balance-rr
+    bond_mode 802.3ad
+    bond_miimon    200
+    bond_downdelay 600
+    bond_updelay   600
+
diff -Nru network-manager-0.9.4.0/debian/tests/Makefile network-manager-0.9.4.0/debian/tests/Makefile
--- network-manager-0.9.4.0/debian/tests/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ network-manager-0.9.4.0/debian/tests/Makefile	2012-11-29 14:14:52.000000000 +0100
@@ -0,0 +1,20 @@
+#!/usr/bin/make -f
+
+tests: ifbmsh_test
+
+IFBMSH := ../ifblacklist_migrate.sh
+IFBMSH_TESTS := if-000 if-001 if-002 if-003 if-004 if-005 if-006 if-007 if-008 if-009 if-010
+
+ifbmsh_test: $(IFBMSH)
+	@for i in $(IFBMSH_TESTS); do \
+		echo -n "Testing $$i: "; \
+		cp $${i}.in $${i}.test ; \
+		NIF_FILE=$${i}.test sh $(IFBMSH) > /dev/null ; \
+		if cmp -s $${i}.out $${i}.test; then echo "OK"; \
+		else echo "FAIL"; exit 1; fi; \
+	done
+
+clean:
+	rm -f if-*.test*
+
+.PHONY: tests ifbmsh_test clean
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-utopia-maintainers/attachments/20121130/8e18c7ec/attachment-0001.pgp>


More information about the Pkg-utopia-maintainers mailing list