]> git.proxmox.com Git - ifupdown2.git/blob - debian/patches/pve/0010-postinst-rm-update-network-config-compatibility.patch
b6a87bebc0fe4d67571ebc9b0025920e10a50a25
[ifupdown2.git] / debian / patches / pve / 0010-postinst-rm-update-network-config-compatibility.patch
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
16 @@ -85,6 +85,24 @@ postinst_remove_diverts()
17 _postinst_remove_diverts "/usr/share/man/man5/interfaces.5.gz"
18 }
19
20 +proxmox_compatibility()
21 +{
22 + perl -e '
23 + use PVE::INotify;
24 + my $config = PVE::INotify::read_file('interfaces', 1);
25 + my $configdata = $config->{data};
26 +
27 + PVE::INotify::write_file('interfaces', $configdata);
28 +
29 + $config = PVE::INotify::read_file('interfaces', 1);
30 +
31 + if (defined($config->{changes})) {
32 + print $config->{changes};
33 + print "network config changes has been detected for ifupdown2 compatibility and generated in /etc/network/interfaces.new\n";
34 + }
35 + ' || true
36 +}
37 +
38 case "$1" in
39 configure)
40 fix_dhclient_file_with_space
41 @@ -92,6 +110,7 @@ case "$1" in
42 process_udev
43 chmod +x /usr/share/ifupdown2/__main__.py
44 postinst_remove_diverts
45 + proxmox_compatibility
46 ;;
47
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()
54 fi
55 }
56
57 +proxmox_compatibility()
58 +{
59 + perl -e '
60 + use PVE::INotify;
61 + my $config = PVE::INotify::read_file('interfaces', 1);
62 + my $configdata = $config->{data};
63 +
64 + PVE::INotify::write_file('interfaces', $configdata);
65 +
66 + $config = PVE::INotify::read_file('interfaces', 1);
67 +
68 + if (defined($config->{changes})) {
69 + print $config->{changes};
70 + print "network config changes has been detected for ifupdown1 compatibility and generated in /etc/network/interfaces.new\n";
71 + }
72 + ' || true
73 +}
74 +
75 case "$1" in
76 purge|remove|abort-install|disappear)
77 process_state_file
78 process_udev
79 + proxmox_compatibility
80 ;;
81
82 upgrade|failed-upgrade|abort-upgrade|disappear)
83 --
84 2.20.1
85