From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH dab 1/1] add support for repositories, used only for template generation
Date: Tue, 30 Sep 2025 16:51:27 +0200 [thread overview]
Message-ID: <20250930145130.789435-2-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20250930145130.789435-1-s.ivanov@proxmox.com>
One use-case are the proxmox-mail-gateway container templates, which
ship the correct enterprise-repsitory entry.
Currently the used entry is removed via `sed` during container
creation. With deb822 sources the `sed` command would become a bit
unwieldy, so just add the option to define sources which are only
used for the container preparation
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
PVE/DAB.pm | 31 ++++++++++++++++++++++++++++---
dab | 6 ++++++
2 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/PVE/DAB.pm b/PVE/DAB.pm
index f74d363..59397f2 100644
--- a/PVE/DAB.pm
+++ b/PVE/DAB.pm
@@ -222,7 +222,7 @@ sub read_config {
chomp $res->{description};
} elsif ($rec =~ s/^([^:]+):\s*(.*\S)\s*\n//) {
my ($key, $value) = (lc ($1), $2);
- if ($key eq 'source' || $key eq 'mirror') {
+ if ($key eq 'source' || $key eq 'mirror' || $key eq 'install-source') {
push @{$res->{$key}}, $value;
} else {
die "duplicate key '$key'\n" if defined ($res->{$key});
@@ -507,9 +507,33 @@ sub new {
source => $url,
comp => $ca,
suite => $su,
+ keep => 1,
};
} else {
- die "syntax error in source spezification '$s'\n";
+ die "syntax error in source specification '$s'\n";
+ }
+ }
+
+ foreach my $is (@{$config->{'install-source'}}) {
+ if ($is =~ m@^\s*((https?|ftp)://\S+)\s+(\S+)((\s+(\S+))+)$@) {
+ my ($url, $su, $components) = ($1, $3, $4);
+ $su =~ s/SUITE/$suite/;
+ $components =~ s/^\s+//;
+ $components =~ s/\s+$//;
+ my $ca;
+ foreach my $co (split (/\s+/, $components)) {
+ push @$ca, $co;
+ }
+ $ca = ['main'] if !$ca;
+
+ push @$sources, {
+ source => $url,
+ comp => $ca,
+ suite => $su,
+ keep => 0,
+ };
+ } else {
+ die "syntax error in install-source specification '$is'\n";
}
}
@@ -1380,7 +1404,8 @@ sub bootstrap {
mkdir "$rootdir/etc/apt/sources.list.d";
my $origin = lc($suiteinfo->{origin});
my $keyring = $suiteinfo->{keyring} or die "missing keyring for origin '$origin'";
- my $uris = { map { $_->{source} => 1 } $self->{sources}->@* };
+ my @keep_sources = grep { $_->{keep} } $self->{sources}->@*;
+ my $uris = { map { $_->{source} => 1 } @keep_sources };
for my $uri (keys $uris->%*) {
my $sources = [ grep { $_->{source} eq $uri } $self->{sources}->@* ];
diff --git a/dab b/dab
index d79afe6..c01c513 100755
--- a/dab
+++ b/dab
@@ -451,6 +451,12 @@ Note: SUITE is a variable and will be substituted.
There are also reasonable defaults for Ubuntu. If you do not specify any source
the defaults are used.
+=item B<Install-Source:> I<URL [components]>
+
+Defines a source location used only during appliance creation. It is
+not added to the sources.list entries in the resulting templates. Else behaves
+like a B<Source:> entry.
+
=item B<Depends:> I<dependencies>
Debian like package dependencies. This can be used to make sure that speific
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-09-30 14:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-30 14:51 [pve-devel] [PATCH dab/dab-pve-appliances] add pmg 9.0 template Stoiko Ivanov
2025-09-30 14:51 ` Stoiko Ivanov [this message]
2025-09-30 15:20 ` [pve-devel] applied: [PATCH dab 1/1] add support for repositories, used only for template generation Thomas Lamprecht
2025-09-30 14:51 ` [pve-devel] [PATCH dab-pve-appliances 1/3] add template for trixie based pmg 9.0 Stoiko Ivanov
2025-10-01 14:12 ` [pve-devel] applied: " Thomas Lamprecht
2025-09-30 14:51 ` [pve-devel] [PATCH dab-pve-appliances 2/3] pmg: trixie: purge ifupdown before installing ifupdown2 Stoiko Ivanov
2025-10-01 14:12 ` [pve-devel] applied: " Thomas Lamprecht
2025-09-30 14:51 ` [pve-devel] [PATCH dab-pve-appliances 3/3] pmg: trixie: use pmg-repository only during installation Stoiko Ivanov
2025-10-01 14:12 ` [pve-devel] applied: " 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=20250930145130.789435-2-s.ivanov@proxmox.com \
--to=s.ivanov@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.