Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an ability to configure default shell #3

Closed
dtritus opened this issue Feb 23, 2016 · 7 comments
Closed

Add an ability to configure default shell #3

dtritus opened this issue Feb 23, 2016 · 7 comments

Comments

@dtritus
Copy link

dtritus commented Feb 23, 2016

Currently launcher starts bash and there is no way to change it to something else.

@elieux
Copy link
Member

elieux commented Feb 23, 2016

I'm inclined to use the login shell defined for your MSYS2 user. Is that fine for your use case?

@hut8
Copy link
Contributor

hut8 commented Mar 8, 2016

@elieux pardon my ignorance but where is the login shell defined? I'm stuck on Windows and really want to use this, but naturally with the same zsh configuration I've had for years 😄

It seems as though /etc/passwd does not exist in MSYS2, And the line I'm guessing needs to be changed is here: https://github.com/elieux/msys2-launcher/blob/master/launcher.c#L227

@elieux
Copy link
Member

elieux commented Mar 8, 2016

You can either set the login shell of everyone using your MSYS2 installation using nsswitch.conf or use mkpasswd -c to create an /etc/passwd entry that you can modify.

@hut8
Copy link
Contributor

hut8 commented Mar 14, 2016

@elieux thanks so much for that. I can get around to a PR in the next couple of days. Am I on the right track by just using getpwent and having the the getpwent implementation use /etc/nsswitch.conf?

@hut8
Copy link
Contributor

hut8 commented Mar 14, 2016

Yikes, I just spent an hour struggling with this: so it looks like the headers search paths end up being here (I yanked these by just adding -v to gcc):

/mingw64/lib/gcc/x86_64-w64-mingw32/5.3.0/include
/mingw64/include
/mingw64/lib/gcc/x86_64-w64-mingw32/5.3.0/include-fixed
/mingw64/x86_64-w64-mingw32/include

None of these seem to contain pwd.h, so I looked for it and it's in /usr/include, right where I expected, but if I try to add that path via either of -I/usr/include or -isystem /usr/include then it blows up in my face (redefinition of time_t, etc, generally indicating I'm not on the right track). Pointers would be appreciated.

@elieux
Copy link
Member

elieux commented Mar 15, 2016

Yeah, the launcher is intentionally independent of msys-2.0.dll and therefore it has no idea about MSYS2 user account settings.

Anyway, the path I was thinking of following, was to invoke mintty as mintty - as per its documentation. Unfortunately that doesn't really work with the launcher's alternative invocation where a command is to be run. I'm thinking of just falling back to /usr/bin/sh in that case.

In Cygwin, we could do some magic using the line below, but MSYS2 doesn't have getent:

$ /usr/bin/bash -c '"$(getent passwd "$(whoami)" | cut -d: -f7)" --login -c '"'"'"$0" "$@"'"'"' "$(getent passwd "$(whoami)" | cut -d: -f7)" "$0" "$@"' mycommand myarguments

@ghost
Copy link

ghost commented Dec 12, 2017

why i use mkpasswd -c,and /etc/passwd just one line ,but it doesn't work,it put a long error stack
I use the .bashrc file in home dirctory,I add 'exec fish' and also add export PATH=$PATH:${my windows path} to solve this problem,and it is simple

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants