From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id EF8DA1FF16F for ; Tue, 30 Sep 2025 16:52:22 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2F2ECB2E3; Tue, 30 Sep 2025 16:52:27 +0200 (CEST) From: Stoiko Ivanov To: pve-devel@lists.proxmox.com Date: Tue, 30 Sep 2025 16:51:27 +0200 Message-Id: <20250930145130.789435-2-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250930145130.789435-1-s.ivanov@proxmox.com> References: <20250930145130.789435-1-s.ivanov@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1759243892458 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.072 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH dab 1/1] add support for repositories, used only for template generation X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" 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 --- 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 I + +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 entry. + =item B I 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