This is the mail archive of the
mailing list for the Cygwin project.
Re: how to let cygwin does not mount /bin /usr/bin automaticlly?
- From: Fergus <fergus at bonhard dot uklinux dot net>
- To: Cygwin ML <cygwin at cygwin dot com>
- Cc: Fergus <fergus at bonhard dot uklinux dot net>
- Date: Wed, 23 Sep 2009 10:14:53 +0100
- Subject: Re: how to let cygwin does not mount /bin /usr/bin automaticlly?
That is great. Thanks for your patient.
I have another question. Can the first field of fstab use relative
path. I expect to make the cygwin portable, that is, i need to move it
to somewhere esle without changing the fstab every time.
If you are using Cygwin in portable mode (presumably on a stick or similar mobile device)
there is a way to achieve what you want - but it is fiddly.
I am guessing that Cygwin is mounted at the root of your device ie /bin, /etc, /usr, and
all the rest are all located under d: or f: or g: or p: or whatever the device might turn out
to be labelled as you move from one host machine to another host machine, and that you do not
want the grief of having to identify the variant drivename every time and manually re-configure
the line in /etc/fstab as
f:/cygwin_1.7/usr/bin /usr/bin ntfs binary 0 0
h:/cygwin_1.7/usr/bin /usr/bin ntfs binary 0 0
accordingly, as might be necessary.
The way I do it (if_there_is_a_better_way_I_would_like_to_know_it) is to start portable Cygwin with
a .cmd file (called go.cmd or something) that resides at the root of the device and starts with the
@if (%DOS_CMD:~1,1%)==(:) set DN=%DOS_CMD:~0,2%
@if (%DOS_CMD:~2,1%)==(:) set DN=%DOS_CMD:~1,2%
All this is designed so that the variable DN (standing for drivename) is exactly D: or F: or G:
or P: as appropriate, and the reason for the five lines is so that this identification is
correctly made however you start Cygwin, whether by
(i) typing go.cmd at the prompt in a Command Prompt window located at F:
(ii) typing f:\go.cmd at the prompt in a Command Prompt window located somewhere else
(iii) double clicking the go.cmd icon in Explorer
(iv) using Start -> Run -> f:\go.cmd
Yeah, I know, all that effort just so that DN accurately identifies the drivename, but it all has to
be done BEFORE Cygwin is triggered. You can then go on, still in go.cmd, to say something like
@%DN%\bin\echo %DN%/cygwin_1.7/usr/bin /usr/bin ntfs binary 0 0 > %DN%\etc\fstab
... any other requirements ... >> %DN%\etc\fstab
and then, FINALLY, start Cygwin with (well, in my case: your requirement might differ)
Awfully sorry for long post. A fiddly way to get something rather simple, but it works in all of
W98, XP, Vista and 7. And there are lots of other reasons (if you are running portable Cygwin off
one device on any number of potential host machines) why you might want to use DN without having
to discover it (or, in fact, even know it) each time.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple