From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] postinst: migrate/update APT auth config
Date: Tue, 13 Sep 2022 14:30:35 +0200 [thread overview]
Message-ID: <20220913123035.3097273-1-f.gruenbichler@proxmox.com> (raw)
missed when switching over to Proxmox::RS::Subscription, which stores
the same info in the product-specific /etc/apt/auth.conf.d/pve.conf .
the top-level file might contain non-PVE-managed entries, so only remove
entries matching "our" machine.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
debian/postinst | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/debian/postinst b/debian/postinst
index 7be1aa3d..d6216607 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -62,6 +62,30 @@ EOF
fi
}
+migrate_apt_auth_conf() {
+ output=""
+ removed=""
+ match=0
+
+ while read l; do
+ if echo "$l" | grep -q "^/machine enterprise.proxmox.com/debian/pmg"; then
+ match=1
+ elif echo "$l" | grep -q "^machine"; then
+ match=0
+ fi
+ done
+
+ if test -n "$removed"; then
+ if test ! -e /etc/apt/auth.conf.d/pmg.conf; then
+ echo "Migrating APT auth config for enterprise.proxmox.com to PMG specific file.."
+ echo "$removed" > /etc/apt/auth.conf.d/pmg.conf
+ else
+ echo "Removing stale APT auth config from /etc/apt/auth.conf"
+ fi
+ echo "$output" > /etc/apt/auth.conf
+ fi
+}
+
case "$1" in
triggered)
# We don't print a status message here, as dpkg already said
@@ -190,6 +214,12 @@ case "$1" in
fi
done
fi
+
+ if test ! -e /proxmox_install_mode && test -n "$2" && dpkg --compare-versions "$2" 'lt' '7.2.11~'; then
+ if test -e /etc/apt/auth.conf ; then
+ migrate_apt_auth_conf
+ fi
+ fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
--
2.30.2
next reply other threads:[~2022-09-13 12:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-13 12:30 Fabian Grünbichler [this message]
2022-09-13 15:03 ` Stoiko Ivanov
2022-09-14 8:05 ` Fabian Grünbichler
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=20220913123035.3097273-1-f.gruenbichler@proxmox.com \
--to=f.gruenbichler@proxmox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.