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,24 @@ postinst_remove_diverts()
17 _postinst_remove_diverts "/usr/share/man/man5/interfaces.5.gz"
20 +proxmox_compatibility()
24 + my $config = PVE::INotify::read_file('interfaces', 1);
25 + my $configdata = $config->{data};
27 + PVE::INotify::write_file('interfaces', $configdata);
29 + $config = PVE::INotify::read_file('interfaces', 1);
31 + if (defined($config->{changes})) {
32 + #print $config->{changes};
33 + print "\nnetwork config changes have been detected for ifupdown2 compatibility.\nSaved in /etc/network/interfaces.new for hot-apply or next reboot.\n\n";
40 fix_dhclient_file_with_space
41 @@ -92,6 +110,7 @@ case "$1" in
43 chmod +x /usr/share/ifupdown2/__main__.py
44 postinst_remove_diverts
45 + proxmox_compatibility
48 abort-upgrade|abort-remove|abort-deconfigure)
49 diff --git a/debian/ifupdown2.postrm b/debian/ifupdown2.postrm
50 index 5d90b21..bab3dd0 100644
51 --- a/debian/ifupdown2.postrm
52 +++ b/debian/ifupdown2.postrm
53 @@ -25,10 +25,29 @@ process_udev()
57 +proxmox_compatibility()
61 + my $config = PVE::INotify::read_file('interfaces', 1);
62 + my $configdata = $config->{data};
64 + PVE::INotify::write_file('interfaces', $configdata);
66 + $config = PVE::INotify::read_file('interfaces', 1);
68 + if (defined($config->{changes})) {
69 + #print $config->{changes};
70 + print "\nnetwork config changes have been detected for ifupdown2 to ifupdown1 switch compatibility.\nSaved in /etc/network/interfaces.new for next reboot\n\n";
76 purge|remove|abort-install|disappear)
79 + proxmox_compatibility
82 upgrade|failed-upgrade|abort-upgrade|disappear)