Programmatic Method to Retrieve the Directories that WSL (2) Appends to Your 'PATH
?'
#10956
Unanswered
RandomDSdevel
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I run a Gentoo Linux instance that I originally set up as a WSL 2 distribution instance manually following this guide. My '
PATH
' in shell sessions in this instance doesn't include the directories appended to it because the Gentoo Portage and Gentoo base system package 'sys-apps/baselayout' overrides '$PATH
' in the default system-wide '/etc/profile
' it provides. This effectively makes sessions behave as if the 'interop.appendWindowsPath' setting is set to 'false
' in '.wslconfig
' on the host Windows side even though it isn't. The guide listed above that I initially used to set my WSL 2 instance up provided the source for a Portage user-side package patch, but applying it results in '$PATH
' containing duplicate entries.As mentioned in the GitHub Discussion I just linked to, I tried adapting the user patch in question by adding a use of an in-lined copy of the '
pathmunge
' shell function commonly found in Red Hat Enterprise Linux, CentOS, and Fedora Linux and feeding my 'PATH
' through that, but I couldn't get that to work properly. Is there any programmatic command-line (shell) query that I could use to retrieve the directory elements that WSL 2 appends to distribution instances' 'PATH
's at startup after my Gentoo instance is already running? That would make it either:/etc/profile
directly, as I could potentially add an appropriate entry as a new short script file in '/etc/env.d
,' whether:emerge
'ing (upgrading) 'sys-apps/baselayout' even if I don't add it in as a user patc, I can avoid having to make one, and I can just leave this new short script file hanging loose in '/etc/env.d
'.I'd like to apply these changes instance-wide so they're the default for all user accounts inside the virtualized system.
(I need/want this so I can proceed with resolving this thread I posted asking for help on the Gentoo Forums.)
Beta Was this translation helpful? Give feedback.
All reactions