]>
Commit | Line | Data |
---|---|---|
849ae55d AD |
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 | |
5 | ||
6 | Signed-off-by: Alexandre Derumier <aderumier@odiso.com> | |
7 | --- | |
8 | debian/ifupdown2.postinst | 19 +++++++++++++++++++ | |
9 | debian/ifupdown2.postrm | 19 +++++++++++++++++++ | |
10 | 2 files changed, 38 insertions(+) | |
11 | ||
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 | |
d32cfc02 | 16 | @@ -85,6 +85,25 @@ postinst_remove_diverts() |
849ae55d AD |
17 | _postinst_remove_diverts "/usr/share/man/man5/interfaces.5.gz" |
18 | } | |
19 | ||
20 | +proxmox_compatibility() | |
21 | +{ | |
22 | + perl -e ' | |
d32cfc02 TL |
23 | + my $haspve_common; eval { require PVE::INotify; $haspve_common = 1; }; |
24 | + exit if !$haspve_common; | |
849ae55d AD |
25 | + my $config = PVE::INotify::read_file('interfaces', 1); |
26 | + my $configdata = $config->{data}; | |
27 | + | |
28 | + PVE::INotify::write_file('interfaces', $configdata); | |
29 | + | |
4bb44e06 | 30 | + $config = PVE::INotify::read_file('interfaces', 1); |
849ae55d | 31 | + |
4bb44e06 | 32 | + if (defined($config->{changes})) { |
7298bb3f TL |
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"; | |
849ae55d | 35 | + } |
4bb44e06 | 36 | + ' || true |
849ae55d AD |
37 | +} |
38 | + | |
39 | case "$1" in | |
40 | configure) | |
41 | fix_dhclient_file_with_space | |
42 | @@ -92,6 +110,7 @@ case "$1" in | |
43 | process_udev | |
44 | chmod +x /usr/share/ifupdown2/__main__.py | |
45 | postinst_remove_diverts | |
46 | + proxmox_compatibility | |
47 | ;; | |
48 | ||
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 | |
d32cfc02 | 54 | @@ -25,10 +25,30 @@ process_udev() |
849ae55d AD |
55 | fi |
56 | } | |
57 | ||
58 | +proxmox_compatibility() | |
59 | +{ | |
60 | + perl -e ' | |
d32cfc02 TL |
61 | + my $haspve_common; eval { require PVE::INotify; $haspve_common = 1; }; |
62 | + exit if !$haspve_common; | |
849ae55d AD |
63 | + my $config = PVE::INotify::read_file('interfaces', 1); |
64 | + my $configdata = $config->{data}; | |
65 | + | |
66 | + PVE::INotify::write_file('interfaces', $configdata); | |
67 | + | |
4bb44e06 | 68 | + $config = PVE::INotify::read_file('interfaces', 1); |
849ae55d | 69 | + |
4bb44e06 | 70 | + if (defined($config->{changes})) { |
7298bb3f TL |
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"; | |
849ae55d | 73 | + } |
4bb44e06 | 74 | + ' || true |
849ae55d AD |
75 | +} |
76 | + | |
77 | case "$1" in | |
78 | purge|remove|abort-install|disappear) | |
79 | process_state_file | |
80 | process_udev | |
81 | + proxmox_compatibility | |
82 | ;; | |
83 | ||
84 | upgrade|failed-upgrade|abort-upgrade|disappear) | |
85 | -- | |
86 | 2.20.1 | |
87 |