delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/10/29/13:22:42

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <001101c39e49$94cfe680$0b7b2852@leper>
Reply-To: <fergus AT bonhard DOT uklinux DOT net>
From: <fergus AT bonhard DOT uklinux DOT net>
To: <cygwin AT cygwin DOT com>
Cc: <fergus AT bonhard DOT uklinux DOT net>
Subject: Re: Launching cygwin from cd
Date: Wed, 29 Oct 2003 18:22:16 -0000
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
X-OriginalArrivalTime: 29 Oct 2003 18:22:17.0456 (UTC) FILETIME=[9580E700:01C39E49]

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019