]> git.proxmox.com Git - ifupdown2.git/blob - debian/patches/pve/0010-postinst-rm-update-network-config-compatibility.patch
postinst/postrm: only update network config on pve-common using systems
[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,25 @@ postinst_remove_diverts()
17 _postinst_remove_diverts "/usr/share/man/man5/interfaces.5.gz"
18 }
19
20 +proxmox_compatibility()
21 +{
22 + perl -e '
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};
27 +
28 + PVE::INotify::write_file('interfaces', $configdata);
29 +
30 + $config = PVE::INotify::read_file('interfaces', 1);
31 +
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";
35 + }
36 + ' || true
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
54 @@ -25,10 +25,30 @@ process_udev()
55 fi
56 }
57
58 +proxmox_compatibility()
59 +{
60 + perl -e '
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};
65 +
66 + PVE::INotify::write_file('interfaces', $configdata);
67 +
68 + $config = PVE::INotify::read_file('interfaces', 1);
69 +
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";
73 + }
74 + ' || true
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