[Pkg-utopia-commits] r3768 - in /packages/unstable/networkmanager/debian: changelog ifblacklist_migrate.sh network-manager.install network-manager.postinst network-manager.postrm network-manager.preinst

biebl at users.alioth.debian.org biebl at users.alioth.debian.org
Wed Nov 17 21:58:42 UTC 2010


Author: biebl
Date: Wed Nov 17 21:58:42 2010
New Revision: 3768

URL: http://svn.debian.org/wsvn/pkg-utopia/?sc=1&rev=3768
Log:
Integrate debian/ifblacklist_migrate.sh from Ubuntu and install
it in /usr/lib/NetworkManager. Improve it to disable the interfaces
with a #NetworkManager# prefix and re-enable them when the package is
removed. (Closes: #530024)

Added:
    packages/unstable/networkmanager/debian/ifblacklist_migrate.sh
Modified:
    packages/unstable/networkmanager/debian/changelog
    packages/unstable/networkmanager/debian/network-manager.install
    packages/unstable/networkmanager/debian/network-manager.postinst
    packages/unstable/networkmanager/debian/network-manager.postrm
    packages/unstable/networkmanager/debian/network-manager.preinst

Modified: packages/unstable/networkmanager/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-utopia/packages/unstable/networkmanager/debian/changelog?rev=3768&op=diff
==============================================================================
--- packages/unstable/networkmanager/debian/changelog (original)
+++ packages/unstable/networkmanager/debian/changelog Wed Nov 17 21:58:42 2010
@@ -1,3 +1,13 @@
+network-manager (0.8.1-4) UNRELEASED; urgency=low
+
+  [ Raphaël Hertzog ]
+  * Integrate debian/ifblacklist_migrate.sh from Ubuntu and install
+    it in /usr/lib/NetworkManager. Improve it to disable the interfaces
+    with a #NetworkManager# prefix and re-enable them when the package is
+    removed. (Closes: #530024)
+
+ -- Michael Biebl <biebl at debian.org>  Wed, 17 Nov 2010 22:55:44 +0100
+
 network-manager (0.8.1-3) unstable; urgency=low
 
   * debian/control

Added: packages/unstable/networkmanager/debian/ifblacklist_migrate.sh
URL: http://svn.debian.org/wsvn/pkg-utopia/packages/unstable/networkmanager/debian/ifblacklist_migrate.sh?rev=3768&op=file
==============================================================================
--- packages/unstable/networkmanager/debian/ifblacklist_migrate.sh (added)
+++ packages/unstable/networkmanager/debian/ifblacklist_migrate.sh Wed Nov 17 21:58:42 2010
@@ -1,0 +1,66 @@
+#!/bin/sh
+
+# (C) 2007 Canonical Ltd.
+# Author: Alexander Sack <asac at jwsdot.com>
+# License: GNU General Public License, version 2 or any later version
+
+if test x$NIF_FILE = x; 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
+
+backup_suffix=0
+while test -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.*$i.*\)$/#NetworkManager#\1/" $NIF_FILE
+	echo done.
+    done
+fi
+

Modified: packages/unstable/networkmanager/debian/network-manager.install
URL: http://svn.debian.org/wsvn/pkg-utopia/packages/unstable/networkmanager/debian/network-manager.install?rev=3768&op=diff
==============================================================================
--- packages/unstable/networkmanager/debian/network-manager.install (original)
+++ packages/unstable/networkmanager/debian/network-manager.install Wed Nov 17 21:58:42 2010
@@ -18,4 +18,5 @@
 debian/tmp/etc/NetworkManager/dispatcher.d/
 debian/tmp/etc/NetworkManager/system-connections/
 debian/tmp/lib/udev/rules.d/*.rules
+debian/ifblacklist_migrate.sh /usr/lib/NetworkManager
 debian/NetworkManager.conf etc/NetworkManager/

Modified: packages/unstable/networkmanager/debian/network-manager.postinst
URL: http://svn.debian.org/wsvn/pkg-utopia/packages/unstable/networkmanager/debian/network-manager.postinst?rev=3768&op=diff
==============================================================================
--- packages/unstable/networkmanager/debian/network-manager.postinst (original)
+++ packages/unstable/networkmanager/debian/network-manager.postinst Wed Nov 17 21:58:42 2010
@@ -66,6 +66,11 @@
         if dpkg --compare-versions "$2" lt "0.8.1-2"; then
             mv_conffile "/etc/NetworkManager/nm-system-settings.conf" "/etc/NetworkManager/NetworkManager.conf"
         fi
+
+        if [ -z "$2" ] || dpkg --compare-versions "$2" lt-nl "0.8.1-4"; then
+            echo "Disabling interfaces configured with plain DHCP in /etc/network/interfaces so that NetworkManager can take them over"
+            sh /usr/lib/NetworkManager/ifblacklist_migrate.sh
+        fi
         ;;
 
     abort-upgrade|abort-deconfigure|abort-remove)
@@ -78,5 +83,4 @@
 esac
 
 #DEBHELPER#
-exit 0
 

Modified: packages/unstable/networkmanager/debian/network-manager.postrm
URL: http://svn.debian.org/wsvn/pkg-utopia/packages/unstable/networkmanager/debian/network-manager.postrm?rev=3768&op=diff
==============================================================================
--- packages/unstable/networkmanager/debian/network-manager.postrm (original)
+++ packages/unstable/networkmanager/debian/network-manager.postrm Wed Nov 17 21:58:42 2010
@@ -24,7 +24,15 @@
             rmdir --ignore-fail-on-non-empty /var/lib/NetworkManager
         fi
         ;;
-    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    remove)
+        # Restore the ifupdown configuration that were disabled at installation
+        backup_suffix=0
+        while test -e /etc/network/interfaces.bak-${backup_suffix}; do
+            backup_suffix=$(($backup_suffix + 1))
+        done
+        sed -i.bak-${backup_suffix} -e "s/^#NetworkManager#//g" /etc/network/interfaces
+        ;;
+    upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
         ;;
 
     *)
@@ -34,5 +42,3 @@
 esac
 
 #DEBHELPER#
-
-exit 0

Modified: packages/unstable/networkmanager/debian/network-manager.preinst
URL: http://svn.debian.org/wsvn/pkg-utopia/packages/unstable/networkmanager/debian/network-manager.preinst?rev=3768&op=diff
==============================================================================
--- packages/unstable/networkmanager/debian/network-manager.preinst (original)
+++ packages/unstable/networkmanager/debian/network-manager.preinst Wed Nov 17 21:58:42 2010
@@ -100,4 +100,3 @@
 esac
 
 #DEBHELPER#
-exit 0




More information about the Pkg-utopia-commits mailing list