From 0f8434c3aa988e1096213a60b14ded77cf0dbe60 Mon Sep 17 00:00:00 2001 From: Stephen Valdinger Date: Fri, 11 Nov 2022 11:50:22 -0500 Subject: [PATCH] (#2781) Add chocolateyPackageId to env variables Previously the only env variable to reference a Chocolatey package id was $env:ChocolateyPackageName. This is inconsistent with the nusepec file where it is referenced as id. This commit adds chocolateyPackageId and packageId to the available environment variables available inside the PowerShell host allowing a package maintainer to reference the id of a package with the more idiomatic $env:ChocolateyPackageId. --- src/chocolatey/infrastructure.app/services/PowershellService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/chocolatey/infrastructure.app/services/PowershellService.cs b/src/chocolatey/infrastructure.app/services/PowershellService.cs index 6f1be64f55..702bdc9a0c 100644 --- a/src/chocolatey/infrastructure.app/services/PowershellService.cs +++ b/src/chocolatey/infrastructure.app/services/PowershellService.cs @@ -435,6 +435,8 @@ public void prepare_powershell_environment(IPackage package, ChocolateyConfigura Environment.SetEnvironmentVariable("chocolateyPackageName", package.Id); Environment.SetEnvironmentVariable("packageName", package.Id); + Environment.SetEnvironmentVariable("chocolateyPackageId", package.Id); + Environment.SetEnvironmentVariable("packageId", package.Id); Environment.SetEnvironmentVariable("chocolateyPackageTitle", package.Title); Environment.SetEnvironmentVariable("packageTitle", package.Title); Environment.SetEnvironmentVariable("chocolateyPackageVersion", package.Version.to_string());