]> git.proxmox.com Git - ifupdown2.git/blame - debian/patches/pve/0010-postinst-rm-update-network-config-compatibility.patch
install/purge compat change, graceful exit
[ifupdown2.git] / debian / patches / pve / 0010-postinst-rm-update-network-config-compatibility.patch
CommitLineData
849ae55d
AD
1From e93b858e2c6d46f3c7166f8b980518457e7f2e65 Mon Sep 17 00:00:00 2001
2From: Alexandre Derumier <aderumier@odiso.com>
3Date: Fri, 21 Feb 2020 10:01:59 +0100
4Subject: [PATCH] postinst/rm : update network config compatibility
5
6Signed-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
12diff --git a/debian/ifupdown2.postinst b/debian/ifupdown2.postinst
13index 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+
4bb44e06 29+ $config = PVE::INotify::read_file('interfaces', 1);
849ae55d 30+
4bb44e06 31+ if (defined($config->{changes})) {
849ae55d
AD
32+ print $config->{changes};
33+ print "network config changes has been detected for ifupdown2 compatibility and generated in /etc/network/interfaces.new\n";
34+ }
4bb44e06 35+ ' || true
849ae55d
AD
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)
49diff --git a/debian/ifupdown2.postrm b/debian/ifupdown2.postrm
50index 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+
4bb44e06 66+ $config = PVE::INotify::read_file('interfaces', 1);
849ae55d 67+
4bb44e06 68+ if (defined($config->{changes})) {
849ae55d
AD
69+ print $config->{changes};
70+ print "network config changes has been detected for ifupdown1 compatibility and generated in /etc/network/interfaces.new\n";
71+ }
4bb44e06 72+ ' || true
849ae55d
AD
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--
842.20.1
85