[pve-devel] [PATCH V3 ifupdown2 3/3] patch : postinst/postrm : convert network config for compatibility

Alexandre Derumier aderumier at odiso.com
Fri Feb 21 10:27:14 CET 2020


---
 ...-update-network-config-compatibility.patch | 85 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 86 insertions(+)
 create mode 100644 debian/patches/pve/0009-postinst-rm-update-network-config-compatibility.patch

diff --git a/debian/patches/pve/0009-postinst-rm-update-network-config-compatibility.patch b/debian/patches/pve/0009-postinst-rm-update-network-config-compatibility.patch
new file mode 100644
index 0000000..fb63db1
--- /dev/null
+++ b/debian/patches/pve/0009-postinst-rm-update-network-config-compatibility.patch
@@ -0,0 +1,85 @@
+From e93b858e2c6d46f3c7166f8b980518457e7f2e65 Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier <aderumier at odiso.com>
+Date: Fri, 21 Feb 2020 10:01:59 +0100
+Subject: [PATCH] postinst/rm : update network config compatibility
+
+Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
+---
+ debian/ifupdown2.postinst | 19 +++++++++++++++++++
+ debian/ifupdown2.postrm   | 19 +++++++++++++++++++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/debian/ifupdown2.postinst b/debian/ifupdown2.postinst
+index 3689256..4b628e1 100644
+--- a/debian/ifupdown2.postinst
++++ b/debian/ifupdown2.postinst
+@@ -85,6 +85,24 @@ postinst_remove_diverts()
+     _postinst_remove_diverts "/usr/share/man/man5/interfaces.5.gz"
+ }
+ 
++proxmox_compatibility()
++{
++    perl -e '
++	use PVE::INotify;
++	my $config = PVE::INotify::read_file('interfaces', 1);
++	my $configdata = $config->{data};
++
++	PVE::INotify::write_file('interfaces', $configdata);
++
++	my $config = PVE::INotify::read_file('interfaces', 1);
++
++	if(defined($config->{changes})) {
++	    print $config->{changes};
++	    print "network config changes has been detected for ifupdown2 compatibility and generated in /etc/network/interfaces.new\n";
++	}
++    '
++}
++
+ case "$1" in
+     configure)
+         fix_dhclient_file_with_space
+@@ -92,6 +110,7 @@ case "$1" in
+         process_udev
+         chmod +x /usr/share/ifupdown2/__main__.py
+         postinst_remove_diverts
++        proxmox_compatibility
+     ;;
+ 
+     abort-upgrade|abort-remove|abort-deconfigure)
+diff --git a/debian/ifupdown2.postrm b/debian/ifupdown2.postrm
+index 5d90b21..bab3dd0 100644
+--- a/debian/ifupdown2.postrm
++++ b/debian/ifupdown2.postrm
+@@ -25,10 +25,29 @@ process_udev()
+     fi
+ }
+ 
++proxmox_compatibility()
++{
++    perl -e '
++        use PVE::INotify;
++        my $config = PVE::INotify::read_file('interfaces', 1);
++        my $configdata = $config->{data};
++
++        PVE::INotify::write_file('interfaces', $configdata);
++
++        my $config = PVE::INotify::read_file('interfaces', 1);
++
++        if(defined($config->{changes})) {
++            print $config->{changes};
++            print "network config changes has been detected for ifupdown1 compatibility and generated in /etc/network/interfaces.new\n";
++        }
++    '
++}
++
+ case "$1" in
+     purge|remove|abort-install|disappear)
+         process_state_file
+         process_udev
++        proxmox_compatibility
+     ;;
+ 
+     upgrade|failed-upgrade|abort-upgrade|disappear)
+-- 
+2.20.1
+
diff --git a/debian/patches/series b/debian/patches/series
index b8c348c..8756e3e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,4 @@ pve/0005-ifreload-down-up-vxlan-interfaces-when-ifreload_down.patch
 pve/0006-config-tuning.patch
 pve/0007-networking.service-fix-dependencies-and-ordering.patch
 pve/0008-add-openvswitch-addon.patch
+pve/0009-postinst-rm-update-network-config-compatibility.patch
-- 
2.20.1




More information about the pve-devel mailing list