[pve-devel] [RFC manager 1/1] api: nodes: set environment variable for shells started via the API

Fabian Ebner f.ebner at proxmox.com
Mon Sep 13 14:04:43 CEST 2021


so that proxmox-ve's apt hook script can detect this.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 PVE/API2/Nodes.pm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index e58d9c10..c57ad995 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -843,13 +843,13 @@ my $sslcert;
 
 my $shell_cmd_map = {
     'login' => {
-	cmd => [ '/bin/login', '-f', 'root' ],
+	cmd => [ '/bin/login', '-f', 'root', 'PVE_API_SHELL=1' ],
     },
     'upgrade' => {
-	cmd => [ '/usr/bin/pveupgrade', '--shell' ],
+	cmd => [ '/usr/bin/env', 'PVE_API_SHELL=1', '/usr/bin/pveupgrade', '--shell' ],
     },
     'ceph_install' => {
-	cmd => [ '/usr/bin/pveceph', 'install' ],
+	cmd => [ '/usr/bin/env', 'PVE_API_SHELL=1', '/usr/bin/pveceph', 'install' ],
 	allow_args => 1,
     },
 };
@@ -866,11 +866,11 @@ sub get_shell_command  {
 		push @$cmd, split("\0", $args);
 	    }
 	} else {
-	    $cmd = [ '/bin/login', '-f', 'root' ];
+	    $cmd = [ '/bin/login', '-f', 'root', 'PVE_API_SHELL=1' ];
 	}
     } else {
 	# non-root must always login for now, we do not have a superuser role!
-	$cmd = [ '/bin/login' ];
+	$cmd = [ '/bin/login', 'PVE_API_SHELL=1' ];
     }
     return $cmd;
 }
-- 
2.20.1





More information about the pve-devel mailing list