6
1
On Windows, I have a C:\msys32 folder (containing what I believe to be a MSYS2 install) created for/by an ESP32 development environment (located in ~/esp). The MSYS home folder includes my Windows username.
Now when I copy that install to another computer, suddenly that folder changes names which I find disturbing by itself, as this isn't "my folder", it is just a name to get around a Linux requirement, it could be some fixed (canonical) name such as 'user'.
More significantly this behaviour means my install isn't portable. Whe I copy the msys32 folder to another computer everything either breaks, or doesn't make any sense. For me it would be best if that username was simply removed from the path, but I'll take second best, which is to give it a fixed name. How can I do that?
PS I understand the goal of msys is to recreate a Linux environment, but please consider that "multi-user" is a dinosaur in todays world where most people are "multi-computer".
It should be portable, but if your username on the new machine is different then it will create a new /home/<username> directory of course. It's also possible that some /etc/fstab or /etc/passwd editing took place. Newer cygwin/msys versions don't need /etc/passwd and in your case a custom /etc/fstab is also not necessary, I think. – T Nierath – 2018-05-09T12:34:01.233
@TNierath Note I explicitly do NOT want to know these things: portable is portable. The username is redundant, this is not a real install, just a dev environment. So the "of course" you mention is really not "of course" to me. That <username> you mention, better be something fixed. I believe that will better attend most users, as nobody cares about usernames, as long as they are distinct. But thank you, you obviously know what you're talking about. – user287749 – 2018-05-09T13:02:05.233
Note that this really breaks otherwise portable installs: apps like Eclipse use the home folder, and it will be wrong. A global search and replace of the username does not resolve. – user287749 – 2018-05-09T13:07:23.927
Well, it isn't portable in that sense. Cygwin simulates a POSIX environment, that means when you start a shell it expects a username, which is derived from your windows account. The programs in /usr /bin and settings in /etc are always the same since they are global settings. For your needs, it shouldn't matter if a new user directory with default config files is created on the fly. However, since the install was created by "ESP32" it could have modified the /etc config files. – T Nierath – 2018-05-09T14:21:21.147
@TNierath "that means when you start a shell it expects a username, which is derived from your windows account". That may seem perfectly logical to you, but it really isn't. Why should that username be the same as my windows account? Why doesn't it allow me to choose? That simple option would make portability possible. Portability means the end of lots of frustrations, for which normal people do not have the time or the means to resolve. But anyhow, there's no way to force a user-selected username (or home folder)? Thanks. – user287749 – 2018-05-09T18:45:09.233
Yes, you can just set a custom home folder, this can be done via /etc/fstab or just by setting %HOME% as a normal Windows environment variable. For more details see: https://cygwin.com/cygwin-ug-net/ntsec.html
– T Nierath – 2018-05-09T19:39:53.377editing /msys32/etc/nsswitch.conf and changing db_home to /home/user at least avoids changes in the home path. I have yet to confirm if this is enough (for the username continues something else). Please @TNierath add a reply, so I can give you credit. – user287749 – 2018-05-09T21:03:44.097
if you don't need a full MSYS environment then you can use mobaxterm which has a portable version
– phuclv – 2018-06-23T12:31:45.257