This page documents how to create a server download tree that Cygwin's setup.exe understands, including the genini script that creates setup.ini files. Please note that the instructions on this page work at the present time, but may change in the future. They are provided on a strictly as-is basis. You can download genini from the Cygwin-apps CVS.

They should be useful for creating a local mirror with or without custom Cygwin packages. At the present, we recommend using an Apache web server running on a Linux distribution such as Debian GNU/Linux since not all the software works properly on Cygwin. If you want information on how to install Cygwin, read the Setting Up Cygwin page. For more information on creating packages that setup.exe understands, read the Cygwin Package Contributor's Guide.

Creating a local Cygwin mirror with rsync

You do not need to know anything about how the server tree is created if you just want a copy of an existing tree. Simply follow these steps:
  1. The first step in creating a local Cygwin mirror is to pick which existing mirror you will download your packages from. A list of mirrors can be found here.
  2. Download the current Cygwin tree. Currently the Cygwin tree is roughly 2.0 GB of disk space. If disk space is a problem, you may want to use a public mirror and only add your own custom packages as described in the next section. (Substitute your chosen mirror for example.com and your DocumentRoot for /var/www/):
    	rsync -vaz rsync://example.com/pub/cygwin/ /var/www/cygwin
    	
  3. Test the mirror by pointing a browser at http://your-server/cygwin/. You should see Cygwin's setup.exe, the setup.bz2 file, the release directory, and other items such as the mailing list archives. If your server is not configured to show directory indexes, you can download http://your-server/cygwin/setup.exe directly. Run setup.exe and type the URL of your server.
  4. Assuming everything works properly, you are almost done. You now have a current Cygwin mirror, but you need to keep it updated by running the rsync command periodically. The easiest way to do this is by putting it in your crontab.

Creating a custom Cygwin package server

NOTE: The instructions below may be out of date. If you are running a custom package server and can update this documentation, please send it to the cygwin-apps list.

The package format that setup.exe understands is well documented in the Cygwin Package Contributor's Guide, which mentions that the setup.ini file (compressed to setup.bz2) is generated by a script. This perl script is named genini, and it can be downloaded from CVS and used to create a custom Cygwin package server. If you are planning on creating a custom package server, we strongly recommend subscribing to the cygwin-apps mailing list where changes in the setup.ini format and genini are discussed and announced.

  1. Download the genini script from the Cygwin-apps CVS. It also requires the Archive::Perl module which you can install via CPAN or apt-get install libarchive-tar-perl on Debian.
  2. Create a directory to store your files (i.e., the setup.* files and the release/ tree). I use /var/www/custom-cygwin/. Put a copy of setup.exe in that directory (for genini to get the version number). If you also created a local mirror as described above, you can link those files:
    	#!/bin/sh
    	mkdir custom-cygwin
    	cd custom-cygwin
    	ln -s /var/www/cygwin/setup.exe .
    	mkdir release
    	cd release
    	ln -s /var/www/cygwin/release/* .
    	
    That way you can use only your custom mirror to get all the packages. Note that whenever a new package is uploaded, you will need to link its directory to your custom mirror.
  3. Add your custom package to the release tree. You can add an empty package in the Base categories that depends on several other packages to automatically install them for anyone using your custom mirror. For example:
    	#!/bin/sh
    	mkdir custompackage
    	cd custompackage
    	touch custompackage-0.0.1-1.tar.bz2
    	touch custompackage-0.0.1-1-src.tar.bz2
    	cat > setup.hint << EOF
    	@ custompackage
    	sdesc: "My favorite packages"
    	ldesc: "My favorite packages"
    	category: Base
    	requires: bzip2 clear cygwin-doc file less openssh pinfo rxvt wget
    	EOF
    	
  4. Run genini to create setup.bz2 for setup.exe:
    	genini > setup
    	bzip2 setup
    	
    You will see error messages from genini about non-existant pacakages if you do not have a full mirror (or if you made an error in a setup.hint file).
  5. Test your mirror with setup.exe!