public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Alexandre Derumier <aderumier@odiso.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH ifupdown2 3/3] update patch10: only rewrite config on first ifupdown2
Date: Mon, 21 Sep 2020 18:51:15 +0200	[thread overview]
Message-ID: <20200921165115.2930386-4-aderumier@odiso.com> (raw)
In-Reply-To: <20200921165115.2930386-1-aderumier@odiso.com>

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>
---
 ...-update-network-config-compatibility.patch | 47 +++++++++++++++----
 1 file changed, 39 insertions(+), 8 deletions(-)

diff --git a/debian/patches/pve/0010-postinst-rm-update-network-config-compatibility.patch b/debian/patches/pve/0010-postinst-rm-update-network-config-compatibility.patch
index ad7c662..226728f 100644
--- a/debian/patches/pve/0010-postinst-rm-update-network-config-compatibility.patch
+++ b/debian/patches/pve/0010-postinst-rm-update-network-config-compatibility.patch
@@ -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>
 Date: Fri, 21 Feb 2020 10:01:59 +0100
 Subject: [PATCH] postinst/rm : update network config compatibility
 
 Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
 ---
- debian/ifupdown2.postinst | 19 +++++++++++++++++++
- debian/ifupdown2.postrm   | 19 +++++++++++++++++++
- 2 files changed, 38 insertions(+)
+ debian/ifupdown2.postinst | 23 +++++++++++++++++++++++
+ debian/ifupdown2.postrm   | 20 ++++++++++++++++++++
+ 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
-index 3689256..4b628e1 100644
+index 3689256..5162109 100644
 --- a/debian/ifupdown2.postinst
 +++ b/debian/ifupdown2.postinst
 @@ -85,6 +85,25 @@ postinst_remove_diverts()
@@ -39,16 +41,19 @@ index 3689256..4b628e1 100644
  case "$1" in
      configure)
          fix_dhclient_file_with_space
-@@ -92,6 +110,7 @@ case "$1" in
+@@ -92,6 +111,10 @@ case "$1" in
          process_udev
          chmod +x /usr/share/ifupdown2/__main__.py
          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)
 diff --git a/debian/ifupdown2.postrm b/debian/ifupdown2.postrm
-index 5d90b21..bab3dd0 100644
+index 5d90b21..fd62294 100644
 --- a/debian/ifupdown2.postrm
 +++ b/debian/ifupdown2.postrm
 @@ -25,10 +25,30 @@ process_udev()
@@ -82,6 +87,32 @@ index 5d90b21..bab3dd0 100644
      ;;
  
      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




  parent reply	other threads:[~2020-09-21 16:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-21 16:51 [pve-devel] [PATCH ifupdown2 0/3] update to last master + fixes Alexandre Derumier
2020-09-21 16:51 ` [pve-devel] [PATCH ifupdown2 1/3] remove patch 0009-address-don-t-process_mtu-if-ovs-mtu-is-defined.patch Alexandre Derumier
2020-09-21 16:51 ` [pve-devel] [PATCH ifupdown2 2/3] patch: allow vlan tag inside vxlan tunnel Alexandre Derumier
2020-09-21 16:51 ` Alexandre Derumier [this message]
2020-09-25  7:30 ` [pve-devel] applied: [PATCH ifupdown2 0/3] update to last master + fixes Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200921165115.2930386-4-aderumier@odiso.com \
    --to=aderumier@odiso.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal