2010-02-23

About Cygwin

Installation and package selection

A good habit is to always have the latest cygwin_setup_executable to have.
Since 2015 you need the lib-usb library to install and the Bonjour Print Services native library from Apple.
In order to have an optimal execution you should always install it on C:\cygwin\ or on D:\cygwin\ .
Install it for "All Users" using the "Unix / binary" mode.

In future updating of packages already on your system, you can simply start the installer and keep hitting "Next" without any other interaction. It remembers what you've already told it.
Now setup.exe has been primed with your preferences, you can update your installation using "unattended" mode with -q.

Cygwin 1.7's setup.exe introduces a -P switch which takes a list of extra packages.
$] setup.exe -q -P aspell-en,cron,ctags,exim,gcc-g++,inetutils,make,mingw-runtime,ncurses,openssh,patch,perl,python,ruby,rxvt,subversion,vim

Configuration
You may have this output at login.

Your group is currently "mkgroup".  This indicates that
the /etc/group (and possibly /etc/passwd) files should be rebuilt.
See the man pages for mkpasswd and mkgroup then, for example, run
mkpasswd -l [-d] > /etc/passwd
mkgroup  -l [-d] > /etc/group
Note that the -d switch is necessary for domain users.


&] cp /etc/passwd /etc/passwd.orig
&] mkpasswd -l -d > /etc/passwd
&] cp /etc/group /etc/group.orig
&] mkgroup -l -d > /etc/group

If you don't know otherwise then you should follow the suggestion, including the note about -d where relevant. After doing that, double-click on the Cygwin icon again to set up your home directory. If you don't then, for example, Terminator will fail to find your home directory and refuse to start.
Even on Cygwin-1.7, you will want to follow the above instructions if, for example, ssh is to think of your home directory as something other than /tmp .

Version validation
$] grep -e 'Installing .*cygwin-[0-9].*\.bz2' /var/log/setup.log

Using environment variables

We may use the following:
  • CYGWIN='tty acl nodosfilewarning title glob winsymlinks proc_retry:3' #ntsec deprecated
  • CYGWIN_HOME=D:\cygwin
  • CYGWIN_PATH=%CYGWIN_HOME%\bin;%CYGWIN_HOME%\sbin;%CYGWIN_HOME%\usr\bin;%CYGWIN_HOME%\usr\sbin;%CYGWIN_HOME%\usr\local\bin
  • CYGWIN_PATH=D:\cygwin\bin;D:\cygwin\sbin;D:\cygwin\usr\bin;D:\cygwin\usr\sbin;D:\cygwin\usr\local\bin
  • LANG=en_US.UTF-8
  • TERM=cygwin
  • HOME="%HOME%\%HOMEPATH%" # A) map it to your windows home using windows user variables *
  • HOME=E: for system and export HOME=%HOME %\%USERNAME% # B) map it to another drive *
  • &] rm -rf "/home/$USERNAME" ; ln -s "/home/$HOME" "/home/$USERNAME" # only for A) and B) *
  • HOME="/home/%USERNAME%" # C) create a default directory in cygwin using windows user variables
  • concat HOME to fstab: $] echo "$USERPROFILE /home/$USERNAME ntfs binary  0 0" >>/etc/fstab ; # D) mount your windows home
  • &] unset TEMPDIR; export TEMPDIR=/temp
  • &] unset TMP; export TMP=/tmp
  • &] unset TEMP; export TEMP=/temp
  • &] export EDITOR=
  • &] export VISUAL=
Using Cygwin to map your WindowsXP home
&] ls ~/My\ Documents/ | while read trgt_ ; do link_=` echo "$trgt_" | sed 's/My\ //g' ` ; echo "ln -s My Documents/$trgt_ $link_" ; ln -s ~/"My Documents/$trgt_" ~/"$link_" ; done
&] ln -s ~/My\ Documents ~/Documents
&] ln -s "$HOMEDRIVE$HOMEPATH"/Application\ Data ~/Application\ Data
&] ln -s "$HOMEDRIVE$HOMEPATH"/Cookies ~/Cookies
&] ln -s "$HOMEDRIVE$HOMEPATH"/Desktop ~/Desktop
&] ln -s "$HOMEDRIVE$HOMEPATH"/Favorites ~/Favorites
&] ln -s "$HOMEDRIVE$HOMEPATH"/Local\ Settings ~/Local\ Settings
&] ln -s "$HOMEDRIVE$HOMEPATH"/NetHood ~/NetHood
&] ln -s "$HOMEDRIVE$HOMEPATH"/PrintHood ~/PrintHood
&] ln -s "$HOMEDRIVE$HOMEPATH"/Recent ~/Recent
&] ln -s "$HOMEDRIVE$HOMEPATH"/SendTo ~/SendTo
&] ln -s "$HOMEDRIVE$HOMEPATH"/Start\ Menu ~/Start\ Menu
&] ln -s "$HOMEDRIVE$HOMEPATH"/Templates ~/Templates
&] ln -s "$HOMEDRIVE$HOMEPATH"/Tracing ~/Tracing
&] ln -s "$HOMEDRIVE$HOMEPATH"/UserData ~/UserData
&] ln -s "$HOMEDRIVE$HOMEPATH"/My\ Videos Movies
&] mkdir perl5 Sites iTunes
&] ln -s /cygdrive/W ~/wuala
&] ln -s wuala/WualaDrive WualaDrive
&] ln -s /cygdrive/Z ~/ZumoDrive

Using Cygwin in the Command Prompt
We can always use Cygwin commands if we add the environement variables in Path=Path;%CYGWIN_HOME%;%CYGWIN_PATH%
.
|-- Application Data
|-- Cookies
|-- Desktop
|-- Documents
|-- Downloads
|-- Dropbox
|-- eBooks
|-- Favorites
|-- Local Settings
|-- Magic Briefcase
|-- Movies
|-- Music
|-- My Documents
|-- NetHood
|-- perl5
|-- Pictures
|-- PrintHood
|-- Public
|-- Received Files
|-- Recent
|-- RemoteDesktop
|-- Resumes
|-- SendTo
|-- Sites
|-- Start Menu
|-- Templates
|-- Tracing
|-- UserData
|-- Videos
|-- Visual Studio 2008
|-- WirelessConnexions
|-- wuala
`-- ZumoDrive

Optimizing Hard Drive
There are good Drives to have:
  • /root folder with its environment variable &] unset ROOTDRIVE; export ROOTDRIVE=/root
  • /Applications folder with its environment variable &] unset APPSDRIVE; export APPSDRIVE=/Applications
  • /home folder with no environment variable export ?
  • /data folder with its environment variable &] unset DATADRIVE; export DATADRIVE=/data
  • /shar folder with its environment variable &] unset SHARDRIVE; export SHARDRIVE=/shar
  • /opt folder with its environment variable &] unset OPTSDRIVE; export OPTSDRIVE=/opt
Choosing a better console: rxvt

You can launch it using:
$] /usr/bin/rxvt -fn Terminal -scrollBar_right -bg blue4 -fg white -ls --saveLines 9999

Adding cool commands
There are good commands to have:
  • tree from his website copy it to / and uncompress it to install
  • mrxvt from his website and follow the procedure
  • fonts
  • asd
Default permissions

$] chmod o-w /usr/local/bin
$] chmod o-w /usr/local
$] chmod o-w /usr
$] chmod o-w /etc
$] chmod o-w /usr/sbin
$] chmod o-w /usr/bin
$] chmod o-w /usr/X11R6/bin
$] chmod o-w /usr/X11R6
$] chmod o-w /cygdrive/c
 

Install aptitude for cygwin

Try this apt-cyg a command-line installer for Cygwin which cooperates with Cygwin Setup and uses the same repository. The syntax is similar to apt-get.
$] svn --force export http://apt-cyg.googlecode.com/svn/trunk/ /bin/ 
$] chmod +x /bin/apt-cyg
$] apt-cyg install nano 

Its usage goes as it follows:
  • "apt-cyg install " to install packages
  • "apt-cyg remove " to remove packages
  • "apt-cyg update" to update setup.ini
  • "apt-cyg show" to show installed packages
  • "apt-cyg find " to find packages matching patterns
  • "apt-cyg describe " to describe packages matching patterns
  • "apt-cyg packageof " to locate parent package

Case sensitive filenames

In the Win32 subsystem filenames are only case-preserved, but not case-sensitive. You can't access two files in the same directory which only differ by case, like Abc and aBc. While NTFS (and some remote filesystems) support case-sensitivity, the NT kernel starting with Windows XP does not support it by default. Rather, you have to tweak a registry setting and reboot. For that reason, case-sensitivity can not be supported by Cygwin, unless you change that registry value.
If you really want case-sensitivity in Cygwin, you can switch it on by setting the registry value
"HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\obcaseinsensitive"
to 0 and reboot the machine. For least surprise, Cygwin expects this registry value also on Windows NT4 and Windows 2000, which usually both don't know this registry key. If you want case-sensitivity on these systems, create that registry value and set it to 0. On these systems (and only on these systems) you don't have to reboot to bring it into effect, rather stopping all Cygwin processes and then restarting them is sufficient.

    No comments:

    HTMLCode

    HTMLCode Content