20090619

yourfilehost/?af=off
--
map{ map{tr|10|# |;print} split//,sprintf"%.8b\n",$_}
unpack'C*',unpack'u*',"5`#8<3'X`'#8^-@`<-CPP`#8V/C8`"

20090616

http://sites.google.com/site/devinsezer/Home/software/portable-cygwin

Ali Devin Sezer, 5 Feb 2005




Cygwin is a software package that
enables one to work in a UNIX-like environment
under a Windows machine. It is fast, reliable and easy
to install. It has most of the applications
one uses on UNIX (gcc, X, xfig, latex, Perl, bash, ps
tools, textutils,...) and most of it is covered by the GNU
public license. Cygwin supports many flavors of Windows:XP, 2000,
98, etc. For more info on cygwin go to
Cygwin.com.

The goal of this page is to describe a way of
installing cygwin on a portable storage device like a portable hard drive
or a USB memory stick. The main use of such a setup, obviously, is that
it enables you to carry a UNIX like system in your pocket everywhere
you go and use any Windows machine (e.g. Windows pc's at your
university library) with your own powerful cygwin/UNIX tools.



Choice of Portable device


The choice of device doesn't really change the installation process.
However here are some notes on this issue:


The rest of this note is independent of the choice of portable storage device.

Choice of Filesystem


You have two realistic choices for a file system (FS) on your portable storage
device:fat32 and ntfs. (For those who are not familiar with
FSs: FS is what is installed on a storage device when you format
it. The formatting software asks you which kind of FS you want).
Although NTFS is a much better FS, I had read/write permission problems
with it when using different computers on which i had different accounts.
A simplistic solution to this problem is to use fat32.
That's what I do.

Installation


I assume that your portable storage device is already formatted.
Here are the steps:
  • Go to cygwin.com and
    install cygwin on your portable storage device.
    Let's designate your
    portable storage device with "E:\" and assume that you installed cygwin in
    "E:\cygwin".

    As is, this installation will work only when your portable storage device
    is connected to the computer on which you performed the installation. What
    follows is
    what you need to do so that your cygwin can work with any host
    windows computer.


  • Unless it is not there, create the directory "E:\cygwin\home". Then
    create the directory "E:\cygwin\home\username", where
    username is a user name that you pick. (e.g. your name).
    This will be your home directory:
    whenever you start an rxvt or an xterm it will start with this directory
    as the current directory.


  • Copy profile to E:\cygwin\etc. Open it
    with an editor (e.g. notepad) and replace the phrase "username" (it
    occurs twice) with the user name you have chosen above.



    The scripts ``X.bat'' and ``uninstall.bat'' modify host's registry. They insert several keys in the CURRENT USER
    and LOCAL MACHINE
    sections of the registry. These keys are modified through the ``mount'' command of cygwin and are
    referred to by cygwin to find out which directories on the Windows directory structure are going to be
    mapped to /bin, /lib and /. If cygwin is already installed on the host, "X.bat"
    will save these entries before changing them. The modified entries are
    later restored when you are done using your portable cygwin and run
    the "uninstall.bat" script.




  • Download
    X.tab
    and put it in "E:\". Rename it "X.bat" [*].
    This script
    assumes that you installed cygwin under "E:\cygwin" on
    your storage device. If you installed it in some other directory
    you will need to modify this script to reflect that (
    X.bat figures out the drive label of the portable device [assumed
    to be E in this discussion] on its own. So you have to change X.bat only
    if cygwin is installed in some directory other than "cygwin" in the
    root directory of your portable storage device).

    X.bat inserts several keys into the windows
    registry. This is required for cygwin to work. It also saves any key
    values that it might alter.
    Finally it starts a copy of the X server and a terminal
    (assuming that X and rxvt were installed in step 1).


  • Download uninstall.tab and put it in "E:\".
    Rename it to "uninstall.bat" [*]. Run this script once you are done
    using cygwin and quit all cygwin software. It restores any registry
    keys that might have been altered when running "X.bat".

This is it. double clicking
"X.bat" will make cygwin operational and start an X server as well as an
rxvt. When you exit all cygwin software, double click "uninstall.bat".



If you are using a very old windows, replace

 for /f %%A in ('cd') do set WD=%%A

in "X.bat" with
set WD=%1

and start "X.bat" from "Run" in the Start menu by typing
"X.bat [DRIVE]:\" in the Run box,
where [DRIVE] is the letter that Windows assigned to your portable storage
device (`E' in the above examples).


[*]
This script is based on a script by Fergus in the CD-ROM
related postings at cygwin.com (see the links above).




X.tab:
for /F %%A in ('cd') do set WD=%%A
cygwin\bin\mount -m | cygwin\bin\sed s/mount/"%WD%\/cygwin\\/bin\\/mount"/ > cygwin\tmp\mount.log
cygwin\bin\umount -c
cygwin\bin\umount -A
cygwin\bin\mount -bfu %WD%cygwin/ /
cygwin\bin\mount -bfu %WD%cygwin\bin /usr/bin
cygwin\bin\mount -bfu %WD%cygwin\lib /usr/lib

set path=%path%;%WD%cygwin\bin;%WD%cygwin\usr\X11R6\bin
start cygwin\bin\rxvt.exe -title "" -bg "#fafad2" -fg "#000040" -color10 green4 -color14 brown -fn "Lucida Console-14" -geometry 80x58+0+0 -sl 4000 -sr -tn rxvt -e /bin/bash --login -i
set DISPLAY=localhost:0.0
run cygwin\usr\X11R6\bin\XWin -multiwindow -emulate3buttons 200


uninstal.tab:

cygwin\bin\umount -c
cygwin\bin\umount -A
cygwin\bin\bash cygwin\tmp\mount.log
cygwin\bin\rm cygwin\tmp\mount.log

--
map{ map{tr|10|# |;print} split//,sprintf"%.8b\n",$_}
unpack'C*',unpack'u*',"5`#8<3'X`'#8^-@`<-CPP`#8V/C8`"