This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Multiple cygwin installs: I have to do it, but how?


OK, I think I've almost got it nailed now:  While I can't run multiple
installs simultaneously, I believe I now can have as many installs as I
like, and can run them independently.

The basic strategy is this:

1. Ensure each Cygwin install is in a completely separate directory,
preferably on a completely separate partition.

2. From Windows, never run any Cygwin program directly.  Start with an
instance of bash, and run everything else from bash.

3. From Windows, always start bash from a batch file.

4. For each installation, the bash batch file must do the following:

    A. Remove (and optionally save) all existing mount points in the
Registry.
    B. Remove (and optionally save) the setting of the HOME environment
variable.
    C. Put in the mount points and HOME value this particular installation
needs.
    D. Run bash.
    E. When bash exits and control returns to the batch file, remove the
Registry entries added in B and clear HOME.
    F. Optionally, restore those mount points present before A, as well as
the prior value of HOME from B.

There are certainly other ways to do this, and the one above has not been
proven to be bullet proof.  In particular, the following issues arise when
multiple Cygwin installations present:

1. Installs could be for "just me" or for "all".  This affects where the
Registry keys go:  HKEY_CURRENT_USER or HKEY_LOCAL MACHINE.

2. Mounts created by the installs could be for "text" or "binary".  Sharing
file areas among multiple installs can become a problem.  Be careful.

3. If you get annoying messages about the presence of multiple Cygwin DLLs,
you have two choices:
A. Simply copy the latest DLL over any older ones.  This is certainly not
risk-free, but it works for me (and is the first step toward merging
installations).
B. Update the DLL registry key
(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App
Paths\cygwin1.dll").

My present bash batch file is an enhanced version of the one from the
current cygwin distribution.  Since I have only two cygwin installs at
present (the "real" Cygwin on E:, and the one distributed with Altera's
Nios tools on D:), it is fairly simple.  I haven't yet added the NetBurner
package...

This is the setup for my "real" Cygwin installation on E:.  The one for
Nios on D: is very similar.  Note::  Cygwin on E: was installed for "all"
and "binary", and Cygwin on D: was installed for "just me" and "text".


Cygwin.bat
----------
@echo off
regedit /s E:\cygwin\Cygwin.reg
set HOME=D:\BobC
E:
chdir \cygwin\bin
bash --login -i
regedit /s E:\cygwin\Nios.reg
set HOME=


Cygwin.reg
----------
REGEDIT4

[-HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/]

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2]

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/]
"native"="E:\\Cygwin"
"flags"=dword:0000000a

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin]
"native"="E:/Cygwin/bin"
"flags"=dword:0000000a

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib]
"native"="E:/Cygwin/lib"
"flags"=dword:0000000a

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App
Paths\cygwin1.dll]
"Path"="E:\\Cygwin"
@="E:\\Cygwin\\cygwin1.dll"


Nios.reg
--------
REGEDIT4

[HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/]
"native"="D:\\Cygwin"

[-HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App
Paths\cygwin1.dll]
"Path"="D:\\Cygwin"
@="D:\\Cygwin\\cygwin1.dll"


As time permits, I will evolve this system.  Ideally, I'd like to only
change a single environment variable to select my installation, then go
from there.  I would still need to flip-flop registry entries, but I can
make this happen via a script (or binary) that is common to all installs
and uses a common database that is shared by all installs (and thus
eliminate having .reg files everywhere).


Regards,

-BobC



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]