[pmg-devel] [PATCH api 2/2] pmgversion: be compatible with minimized container installation

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Mar 19 08:04:08 CET 2019


One can now install PMG in a CT envrionment through the new
proxmox-mailgateway-container meta package, but this wasn't correctly
checked by the API PMG versions code.

Add the new meta package as optional one, and if it is installed
replace the bare-metal meta packge info with it, both can never be
installed at the same time. Also move pve-firmware to the optional
package list.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 PMG/API2/APT.pm | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/PMG/API2/APT.pm b/PMG/API2/APT.pm
index 300f734..f578331 100644
--- a/PMG/API2/APT.pm
+++ b/PMG/API2/APT.pm
@@ -507,6 +507,8 @@ __PACKAGE__->register_method({
 
 	my @opt_pack = qw(
 	    libpve-apiclient-perl
+	    proxmox-mailgateway-container
+	    pve-firmware
 	    zfsutils-linux
 	);
 
@@ -519,7 +521,6 @@ __PACKAGE__->register_method({
 	    pmg-docs
 	    proxmox-spamassassin
 	    proxmox-widget-toolkit
-	    pve-firmware
 	    pve-xtermjs
 	    vncterm
 	);
@@ -547,14 +548,20 @@ __PACKAGE__->register_method({
 	    }
 	    $res->{CurrentState} = $p->{CurrentState};
 
+	    if (grep( /^$pkgname$/, @opt_pack)) {
+		next if $res->{CurrentState} eq 'NotInstalled';
+	    }
+
 	    # hack: add some useful information (used by 'pmgversion -v')
-	    if ($pkgname eq 'proxmox-mailgateway') {
+	    if ($pkgname =~ /^proxmox-mailgateway(-container)?$/) {
 		$res->{ManagerVersion} = $pmgver;
 		$res->{RunningKernel} = $kernel_release;
-	    }
-
-	    if (grep( /^$pkgname$/, @opt_pack)) {
-		next if $res->{CurrentState} eq 'NotInstalled';
+		if ($pkgname eq 'proxmox-mailgateway-container') {
+		    # another hack: replace proxmox-mailgateway with CT meta pkg
+		    shift @$pkglist;
+		    unshift @$pkglist, $res;
+		    next;
+		}
 	    }
 
 	    push @$pkglist, $res;
-- 
2.20.1




More information about the pmg-devel mailing list