1 From e93b858e2c6d46f3c7166f8b980518457e7f2e65 Mon Sep 17 00:00:00 2001
2 From: Alexandre Derumier <aderumier@odiso.com>
3 Date: Fri, 21 Feb 2020 10:01:59 +0100
4 Subject: [PATCH] postinst/rm : update network config compatibility
6 Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
8 debian/ifupdown2.postinst | 19 +++++++++++++++++++
9 debian/ifupdown2.postrm | 19 +++++++++++++++++++
10 2 files changed, 38 insertions(+)
12 diff --git a/debian/ifupdown2.postinst b/debian/ifupdown2.postinst
13 index 3689256..4b628e1 100644
14 --- a/debian/ifupdown2.postinst
15 +++ b/debian/ifupdown2.postinst
16 @@ -85,6 +85,25 @@ postinst_remove_diverts()
17 _postinst_remove_diverts "/usr/share/man/man5/interfaces.5.gz"
20 +proxmox_compatibility()
23 + my $haspve_common; eval { require PVE::INotify; $haspve_common = 1; };
24 + exit if !$haspve_common;
25 + my $config = PVE::INotify::read_file('interfaces', 1);
26 + my $configdata = $config->{data};
28 + PVE::INotify::write_file('interfaces', $configdata);
30 + $config = PVE::INotify::read_file('interfaces', 1);
32 + if (defined($config->{changes})) {
33 + #print $config->{changes};
34 + print "\nnetwork config changes have been detected for ifupdown2 compatibility.\nSaved in /etc/network/interfaces.new for hot-apply or next reboot.\n\n";
41 fix_dhclient_file_with_space
42 @@ -92,6 +110,7 @@ case "$1" in
44 chmod +x /usr/share/ifupdown2/__main__.py
45 postinst_remove_diverts
46 + proxmox_compatibility
49 abort-upgrade|abort-remove|abort-deconfigure)
50 diff --git a/debian/ifupdown2.postrm b/debian/ifupdown2.postrm
51 index 5d90b21..bab3dd0 100644
52 --- a/debian/ifupdown2.postrm
53 +++ b/debian/ifupdown2.postrm
54 @@ -25,10 +25,30 @@ process_udev()
58 +proxmox_compatibility()
61 + my $haspve_common; eval { require PVE::INotify; $haspve_common = 1; };
62 + exit if !$haspve_common;
63 + my $config = PVE::INotify::read_file('interfaces', 1);
64 + my $configdata = $config->{data};
66 + PVE::INotify::write_file('interfaces', $configdata);
68 + $config = PVE::INotify::read_file('interfaces', 1);
70 + if (defined($config->{changes})) {
71 + #print $config->{changes};
72 + print "\nnetwork config changes have been detected for ifupdown2 to ifupdown1 switch compatibility.\nSaved in /etc/network/interfaces.new for next reboot\n\n";
78 purge|remove|abort-install|disappear)
81 + proxmox_compatibility
84 upgrade|failed-upgrade|abort-upgrade|disappear)