about summary refs log tree commit diff
path: root/debian/network-manager.postinst
diff options
context:
space:
mode:
authorBrian Murray <brian@ubuntu.com>2017-09-11 10:20:18 -0700
committerJeremy Bicha <jbicha@ubuntu.com>2017-11-12 17:04:23 -0500
commit22891fd7bb27f495ec8965a338169871d1e8cd57 (patch)
tree143c3a978f18d7877f25ce4dae50600b4fbd4b6c /debian/network-manager.postinst
parent1ab4db73c1f0db30f3af1845a9c41e3c3952dea1 (diff)
handle upgrades from unmanaged policy
Drop in an empty override file for NetworkManager to manage all
devices for upgrade from any version, as long as there is no
netplan configuration yet. (LP: #1676547)
Diffstat (limited to 'debian/network-manager.postinst')
-rw-r--r--debian/network-manager.postinst9
1 files changed, 9 insertions, 0 deletions
diff --git a/debian/network-manager.postinst b/debian/network-manager.postinst
index 0f95087f..b0b6ad30 100644
--- a/debian/network-manager.postinst
+++ b/debian/network-manager.postinst
@@ -44,6 +44,15 @@ case "$1" in
                 ln -sf  /run/NetworkManager/resolv.conf /etc/resolv.conf
             fi
         fi
+
+	if dpkg --compare-versions "$2" le-nl "9999"; then
+		mkdir -p /etc/NetworkManager/conf.d || true
+		# for old versions, override the global config with a null config,
+		# but only if the netplan config has not been modified by an user.
+		if find /etc/netplan -name "*.yaml" | wc -l | grep -qc 0; then
+			touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
+		fi
+	fi
         ;;
 
     abort-upgrade|abort-deconfigure|abort-remove)