]> git.proxmox.com Git - pmg-api.git/commitdiff
pmgversion: be compatible with minimized container installation
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 19 Mar 2019 07:04:08 +0000 (08:04 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 20 Mar 2019 05:45:49 +0000 (06:45 +0100)
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@proxmox.com>
PMG/API2/APT.pm

index 300f7344afcc2d2f69c5fe0f2528698ad08d1f38..f5783319d76de0c49cb93d578e57f1e784cb6311 100644 (file)
@@ -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;