From: Alexandre Derumier Date: Fri, 21 Feb 2020 09:27:14 +0000 (+0100) Subject: patch : postinst/postrm : convert network config for compatibility X-Git-Url: https://git.proxmox.com/?p=ifupdown2.git;a=commitdiff_plain;h=849ae55de6454ea4631de0899182c148c954e46a patch : postinst/postrm : convert network config for compatibility --- 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 index 0000000..fb63db1 --- /dev/null +++ b/debian/patches/pve/0010-postinst-rm-update-network-config-compatibility.patch @@ -0,0 +1,85 @@ +From e93b858e2c6d46f3c7166f8b980518457e7f2e65 Mon Sep 17 00:00:00 2001 +From: Alexandre Derumier +Date: Fri, 21 Feb 2020 10:01:59 +0100 +Subject: [PATCH] postinst/rm : update network config compatibility + +Signed-off-by: Alexandre Derumier +--- + 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 d9c889e..5fd1f12 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -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