diff --git a/powershell-lts/patches/global-profiles-stores-in-etc.patch b/powershell-lts/patches/global-profiles-stores-in-etc.patch new file mode 100644 index 0000000..08d325a --- /dev/null +++ b/powershell-lts/patches/global-profiles-stores-in-etc.patch @@ -0,0 +1,24 @@ +diff --git a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs +index 439826984..d08d21f86 100644 +--- a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs ++++ b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs +@@ -255,16 +255,9 @@ namespace System.Management.Automation + /// The base path for all users profiles. + private static string GetAllUsersFolderPath(string shellId) + { +- string folderPath = string.Empty; +- try +- { +- folderPath = Utils.GetApplicationBase(shellId); +- } +- catch (System.Security.SecurityException) +- { +- } +- +- return folderPath; ++ string folderPath = Environment.GetEnvironmentVariable("POWERSHELL_COMMON_APPLICATION_DATA"); ++ if (!string.IsNullOrEmpty(folderPath)) return folderPath; ++ return "/etc/opt/powershell"; + } + #endregion GetProfileCommands + diff --git a/powershell-preview/patches/global-profiles-stores-in-etc.patch b/powershell-preview/patches/global-profiles-stores-in-etc.patch new file mode 100644 index 0000000..88ce256 --- /dev/null +++ b/powershell-preview/patches/global-profiles-stores-in-etc.patch @@ -0,0 +1,24 @@ +diff --git a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs +index 003625791..18dbda34f 100644 +--- a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs ++++ b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs +@@ -233,16 +233,9 @@ namespace System.Management.Automation + /// The base path for all users profiles. + private static string GetAllUsersFolderPath(string shellId) + { +- string folderPath = string.Empty; +- try +- { +- folderPath = Utils.GetApplicationBase(shellId); +- } +- catch (System.Security.SecurityException) +- { +- } +- +- return folderPath; ++ string folderPath = Environment.GetEnvironmentVariable("POWERSHELL_COMMON_APPLICATION_DATA"); ++ if (!string.IsNullOrEmpty(folderPath)) return folderPath; ++ return "/etc/opt/powershell"; + } + #endregion GetProfileCommands + diff --git a/powershell-stable/patches/global-profiles-stores-in-etc.patch b/powershell-stable/patches/global-profiles-stores-in-etc.patch new file mode 100644 index 0000000..88ce256 --- /dev/null +++ b/powershell-stable/patches/global-profiles-stores-in-etc.patch @@ -0,0 +1,24 @@ +diff --git a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs +index 003625791..18dbda34f 100644 +--- a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs ++++ b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs +@@ -233,16 +233,9 @@ namespace System.Management.Automation + /// The base path for all users profiles. + private static string GetAllUsersFolderPath(string shellId) + { +- string folderPath = string.Empty; +- try +- { +- folderPath = Utils.GetApplicationBase(shellId); +- } +- catch (System.Security.SecurityException) +- { +- } +- +- return folderPath; ++ string folderPath = Environment.GetEnvironmentVariable("POWERSHELL_COMMON_APPLICATION_DATA"); ++ if (!string.IsNullOrEmpty(folderPath)) return folderPath; ++ return "/etc/opt/powershell"; + } + #endregion GetProfileCommands +