]> git.proxmox.com Git - ifupdown2.git/commitdiff
patch : postinst/postrm : convert network config for compatibility
authorAlexandre Derumier <aderumier@odiso.com>
Fri, 21 Feb 2020 09:27:14 +0000 (10:27 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 7 Mar 2020 14:53:25 +0000 (15:53 +0100)
debian/patches/pve/0010-postinst-rm-update-network-config-compatibility.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/pve/0010-postinst-rm-update-network-config-compatibility.patch b/debian/patches/pve/0010-postinst-rm-update-network-config-compatibility.patch
new file mode 100644 (file)
index 0000000..fb63db1
--- /dev/null
@@ -0,0 +1,85 @@
+From e93b858e2c6d46f3c7166f8b980518457e7f2e65 Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier <aderumier@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@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
+
index d9c889e47dc24f6c0209c7b630c93211c6d02ec3..5fd1f123000832635eccb17b550f6f7f78badd94 100644 (file)
@@ -9,3 +9,4 @@ pve/0006-config-tuning.patch
 pve/0007-networking.service-fix-dependencies-and-ordering.patch
 pve/0008-add-openvswitch-addon.patch
 pve/0009-networking.service-ifup-ifdown-allow-ovs-on-start-st.patch
+pve/0010-postinst-rm-update-network-config-compatibility.patch