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]
Other format: [Raw text]

Re: Launching cygwin from cd


There has been quite a lot on this earlier in the year. (Try searching on
"portable", maybe.) I routinely use a CD containing everything but X
applications, but it would be easy to make one that has them, lacking
something else instead. I've got a 1GB USB stick that would accommodate even
more, but I guess that nowadays something approaching 1.5 GB or more would
be needed to accommodate the whole of Cygwin in a convenient portable
manner.

The real complication in using a portable CD version lies in protecting the
host machine from the temporary intrusion of a CD-mounted Cygwin. Of course,
if the host machine and its owner have never heard of Cygwin, and do not
care about it, this is not an issue. If the case is otherwise, then one
needs to take care in any CD-based session that the host version is properly
un-mounted, the CD-version mounted, used then un-mounted, followed by a
proper re-mount of the host version.

It sounds from what you say that these considerations will not apply. So the
main requirement is to build your Cygwin tree so that it contains all you
want. (All the .exe's, all the .dll's, ...) This can be achieved through
trial and error (try rxvt.exe, whoops! it turns out to need libW11.dll, ...)
or by installing a tailored Cygwin using setup.exe, and copying that to CD.

The only question of significance that remains is what to do with the files
/etc/profile, /etc/passwd, /etc/group, ~/.bash_profile, ~/.bashrc; and what
command you use to start the whole thing off when the CD is inserted in its
drive.

An answer that works is: delete the first 4, put the line

    unset HISTFILE

plus anything else you want (aliases, etc) in ~/.bashrc =
/home/whatever/.bashrc (this stops bash trying to write a history file to an
unwriteable CD) and start the whole thing off with a .bat file containing

    @h:\bin\mount -bfu h:/ /
    @h:\bin\mount -bfu h:/bin /usr/bin
    @h:\bin\mount -bfu h:/lib /usr/lib
    @h:\bin\bash -rcfile /.init

where h: is your CD drive letter and where the file /.init (which is on the
CD) contains the lines

    export SHELL=/bin/bash
    export HOME=/home/whatever
    export PATH=~/bin:/usr/local/bin:/usr/bin:/bin:
    export TMPDIR=c:/tmp

(The 4th line is there because I found that for one of my applications I
needed earlier to have created a directory c:\tmp on the host HD, and then
set TMPDIR to match. So, sorry, this recipe is not foolproof for all
applications, because they might have different minor requirements,
depending how they are built. But at least it provides a starting point. And
the one I am talking about was a non-Cygwin-supplied invader: Cygwin is so
tightly constructed that there may be no annoying outstanding requirements
of this type. I also have ~ = /home/user as a conveniently bland HOME name
that so far hasn't caused any problems, but you might prefer some different
/home/whatever as indicated above.)

Hope this helps. It might do as something to start off with, and if you can
use a write-able drive rather than burning experimental CDs as you develop
your portable version, so much the better. (Easier.)

Fergus



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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]