Cygwin

Get that Linux feeling - on Windows

Cygwin Package Server

This page documents how to create a server download tree that Cygwin's setup program understands. 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.

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, but all the required software should work properly on Cygwin.

If you want information on how to install Cygwin, read the Setting Up Cygwin page. For more information on creating packages for Cygwin's setup program, 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. 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/. If your server is configured to show directory indexes, you should see the various arch directories, each containing a release directory. Run Cygwin's setup program 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 an overlay Cygwin package server

TBD.

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 Cygwin's setup program understands is well documented in the Cygwin Package Contributor's Guide, which mentions that the compressed setup.ini file is generated by a script.

This script is named mksetupini, from the calm package. It can be downloaded from git 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 calm are discussed and announced.

  1. Obtain the mksetupini script, on Cygwin by installing the calm Cygwin package, or directly from Cygwin-apps git.
        pip3 install git+http://sourceware.org/git/cygwin-apps/calm.git
      
  2. Create a directory to store your files (i.e., the arch/release/ tree). I use /var/www/custom-cygwin/. If you also created a local mirror as described above, you can link those files:
        #!/bin/sh
        mkdir custom-cygwin
        cd custom-cygwin
        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(s) to the release tree. You can add an empty package in the Base category 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 mksetupini and create compressed setup.ini files for the setup program:
        #!/bin/sh
        cd /var/www/custom-cygwin/
        for ARCH in x86 x86_64 ; do
        mksetupini --arch ${ARCH} --inifile=${ARCH}/setup.ini --releasearea=.
          bzip2 <${ARCH}/setup.ini >${ARCH}/setup.bz2
          xz -6e <${ARCH}/setup.ini >${ARCH}/setup.xz
        done
    You will see error messages from mksetupini about non-existent packages if you do not have a full mirror (or if you made an error in a .hint file).
  5. Test your mirror with the Cygwin setup program!
TBD: The setup-version: line from the mirror should be perpetuated into the generated setup.ini.

Historical note on genini

genini is a script previously used to create setup.ini files. This can no longer be used as it does not currently support Cygwin packages with modern pvr.hint files.

You can download genini from the Cygwin-apps git.

genini also requires the Archive::Perl module which you can install via CPAN, or with apt-get install libarchive-tar-perl or equivalent.