update patch10: only rewrite config on first ifupdown2

we don't want to update config at each upgrade.

postinst can't detect upgrade vs install, it need to be done in preinst.

so I create a tmp file in preinst for first install, and detect this file
in postinst.
(as we need to have ifupdown2 installed first, to have the config rewrite working)

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
Alexandre Derumier 2020-09-21 18:51:15 +02:00 committed by Thomas Lamprecht
parent c5cf5bb912
commit 8d5303c350

View File

@ -1,16 +1,18 @@
From e93b858e2c6d46f3c7166f8b980518457e7f2e65 Mon Sep 17 00:00:00 2001 From 723bfd8e3ed7a6140a411260a4881ed886efc829 Mon Sep 17 00:00:00 2001
From: Alexandre Derumier <aderumier@odiso.com> From: Alexandre Derumier <aderumier@odiso.com>
Date: Fri, 21 Feb 2020 10:01:59 +0100 Date: Fri, 21 Feb 2020 10:01:59 +0100
Subject: [PATCH] postinst/rm : update network config compatibility Subject: [PATCH] postinst/rm : update network config compatibility
Signed-off-by: Alexandre Derumier <aderumier@odiso.com> Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
--- ---
debian/ifupdown2.postinst | 19 +++++++++++++++++++ debian/ifupdown2.postinst | 23 +++++++++++++++++++++++
debian/ifupdown2.postrm | 19 +++++++++++++++++++ debian/ifupdown2.postrm | 20 ++++++++++++++++++++
2 files changed, 38 insertions(+) debian/ifupdown2.preinst | 20 ++++++++++++++++++++
3 files changed, 63 insertions(+)
create mode 100644 debian/ifupdown2.preinst
diff --git a/debian/ifupdown2.postinst b/debian/ifupdown2.postinst diff --git a/debian/ifupdown2.postinst b/debian/ifupdown2.postinst
index 3689256..4b628e1 100644 index 3689256..5162109 100644
--- a/debian/ifupdown2.postinst --- a/debian/ifupdown2.postinst
+++ b/debian/ifupdown2.postinst +++ b/debian/ifupdown2.postinst
@@ -85,6 +85,25 @@ postinst_remove_diverts() @@ -85,6 +85,25 @@ postinst_remove_diverts()
@ -39,16 +41,19 @@ index 3689256..4b628e1 100644
case "$1" in case "$1" in
configure) configure)
fix_dhclient_file_with_space fix_dhclient_file_with_space
@@ -92,6 +110,7 @@ case "$1" in @@ -92,6 +111,10 @@ case "$1" in
process_udev process_udev
chmod +x /usr/share/ifupdown2/__main__.py chmod +x /usr/share/ifupdown2/__main__.py
postinst_remove_diverts postinst_remove_diverts
+ proxmox_compatibility + if [ -f "/tmp/.ifupdown2-first-install" ]; then
+ proxmox_compatibility
+ rm /tmp/.ifupdown2-first-install
+ fi
;; ;;
abort-upgrade|abort-remove|abort-deconfigure) abort-upgrade|abort-remove|abort-deconfigure)
diff --git a/debian/ifupdown2.postrm b/debian/ifupdown2.postrm diff --git a/debian/ifupdown2.postrm b/debian/ifupdown2.postrm
index 5d90b21..bab3dd0 100644 index 5d90b21..fd62294 100644
--- a/debian/ifupdown2.postrm --- a/debian/ifupdown2.postrm
+++ b/debian/ifupdown2.postrm +++ b/debian/ifupdown2.postrm
@@ -25,10 +25,30 @@ process_udev() @@ -25,10 +25,30 @@ process_udev()
@ -82,6 +87,32 @@ index 5d90b21..bab3dd0 100644
;; ;;
upgrade|failed-upgrade|abort-upgrade|disappear) upgrade|failed-upgrade|abort-upgrade|disappear)
diff --git a/debian/ifupdown2.preinst b/debian/ifupdown2.preinst
new file mode 100644
index 0000000..aa8653e
--- /dev/null
+++ b/debian/ifupdown2.preinst
@@ -0,0 +1,20 @@
+#!/bin/sh
+set -e
+
+case "$1" in
+ install)
+ touch /tmp/.ifupdown2-first-install
+ ;;
+
+ upgrade|abort-upgrade)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 0
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
-- --
2.20.1 2.20.1