]> git.proxmox.com Git - ifupdown2.git/commitdiff
update patch10: only rewrite config on first ifupdown2
authorAlexandre Derumier <aderumier@odiso.com>
Mon, 21 Sep 2020 16:51:15 +0000 (18:51 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 25 Sep 2020 07:16:01 +0000 (09:16 +0200)
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>
debian/patches/pve/0010-postinst-rm-update-network-config-compatibility.patch

index ad7c6622b5c90673c25b9296990fb399616ae720..226728f1627dabe05a7191ae638e26f20d662e3c 100644 (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>
 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