public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [RFC ifupdown2] d/maintscripts: use postinst arguments to determine first install
@ 2024-11-13 19:03 Stoiko Ivanov
  2024-11-14 17:40 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Stoiko Ivanov @ 2024-11-13 19:03 UTC (permalink / raw)
  To: pve-devel

Following https://www.debian.org/doc/debian-policy/ap-flowcharts.html
postinst gets called as 'postinst configure' w/o second argument on
first installation, use that information instead of creating a
flag-file in preinst.

Technically this changes the semantics and the first-install parts
will not be run, in case ifupdown2 had been installed on the system,
but was subsequently removed, but not purged ('rc' in dpkg-output).
Since the functionality was added quite a while ago (released with PVE
6.2 to support ovs-setups with ifupdown2 - the potential for
regression should be limited. Originally introduced in:
849ae55de6454ea4631de0899182c148c954e46a

Fixes: 8d5303c35044b612afc68eec1dc5bc265a5dd328
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
sending as RFC, as I'm not sure that the small cosmetic fix is worth
the potetial regressions at all, but after spending a bit too long
reading the commit-history and the debian-policy manual thought I'll
send it anyways.
(Tested with mmebstrap and in an install on top of debian)

 debian/ifupdown2.postinst |  3 +--
 debian/ifupdown2.preinst  | 20 --------------------
 2 files changed, 1 insertion(+), 22 deletions(-)
 delete mode 100644 debian/ifupdown2.preinst

diff --git a/debian/ifupdown2.postinst b/debian/ifupdown2.postinst
index a22b825..f9a719c 100644
--- a/debian/ifupdown2.postinst
+++ b/debian/ifupdown2.postinst
@@ -111,11 +111,10 @@ case "$1" in
         process_udev
         chmod +x /usr/share/ifupdown2/__main__.py
         postinst_remove_diverts
-        if [ -f "/tmp/.ifupdown2-first-install" ] && [ ! -e /proxmox_install_mode ]; then
+        if [ -z "$2" ] && [ ! -e /proxmox_install_mode ]; then
             proxmox_compatibility
             echo "Reloading network config on first install"
             ifreload -a || report_warn "Reloading failed"
-            rm  /tmp/.ifupdown2-first-install
         fi
     ;;
 
diff --git a/debian/ifupdown2.preinst b/debian/ifupdown2.preinst
deleted file mode 100644
index aa8653e..0000000
--- a/debian/ifupdown2.preinst
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/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.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [RFC ifupdown2] d/maintscripts: use postinst arguments to determine first install
  2024-11-13 19:03 [pve-devel] [RFC ifupdown2] d/maintscripts: use postinst arguments to determine first install Stoiko Ivanov
@ 2024-11-14 17:40 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2024-11-14 17:40 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stoiko Ivanov

Am 13.11.24 um 20:03 schrieb Stoiko Ivanov:
> Following https://www.debian.org/doc/debian-policy/ap-flowcharts.html
> postinst gets called as 'postinst configure' w/o second argument on
> first installation, use that information instead of creating a
> flag-file in preinst.
> 
> Technically this changes the semantics and the first-install parts
> will not be run, in case ifupdown2 had been installed on the system,
> but was subsequently removed, but not purged ('rc' in dpkg-output).
> Since the functionality was added quite a while ago (released with PVE
> 6.2 to support ovs-setups with ifupdown2 - the potential for
> regression should be limited. Originally introduced in:
> 849ae55de6454ea4631de0899182c148c954e46a

FWIW, I got a git-alias named show-short that resolves to

show --no-patch --pretty='format: %C(auto)%h ("%s")'

which I use for such references. The main benefit is having the subject
of a commit, which gives some more context without having to check the
history, or allows quickly searching on other sources (e.g., lore for
kernel or our stuff) if the commit would reference another repo.

I do not have all to hard feelings here and am *very* happy about any
Fixes tag, whatever form it is, compared to none at all, just mentioning
it, maybe you see some similar benefits in a similar format.

> 
> Fixes: 8d5303c35044b612afc68eec1dc5bc265a5dd328
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> sending as RFC, as I'm not sure that the small cosmetic fix is worth
> the potetial regressions at all, but after spending a bit too long
> reading the commit-history and the debian-policy manual thought I'll
> send it anyways.
> (Tested with mmebstrap and in an install on top of debian)
> 
>  debian/ifupdown2.postinst |  3 +--
>  debian/ifupdown2.preinst  | 20 --------------------
>  2 files changed, 1 insertion(+), 22 deletions(-)
>  delete mode 100644 debian/ifupdown2.preinst
> 
>

applied, thanks! 


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-14 17:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-13 19:03 [pve-devel] [RFC ifupdown2] d/maintscripts: use postinst arguments to determine first install Stoiko Ivanov
2024-11-14 17:40 ` [pve-devel] applied: " Thomas Lamprecht

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