Cygwin

Get that Linux feeling - on Windows

Cygwin Package Server

This page documents how to create a directory 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.

NOTE: The instructions below may be out of date. If you can help update this documentation, please send corrections to the cygwin-apps mailing list.

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.

Creating a local Cygwin mirror with rsync

You do not need to know anything about how the directory tree is created if you just want a copy of an existing directory 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 directory 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 and the compressed setup.ini files. 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

The contents of the directory tree are described to the setup program by a (compressed) setup.ini file.

This file is generated by the script 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/ directory 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
        for ARCH in x86 x86_64 noarch ; do
          mkdir -p ${ARCH}/release
          cd ${ARCH}/release
          ln -s /var/www/cygwin/${ARCH}/release/* .
          cd ../..
        done
    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 directory tree.
  4. (Optional) Since packages in Base category are always installed, 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
          sdesc: "My favorite packages"
          ldesc: "My favorite packages"
          category: Base
          requires: bzip2 clear cygwin-doc file less openssh pinfo rxvt wget
        EOF
  5. 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).
  6. Test your mirror with the Cygwin setup program!

TBD: Discuss the need to sign setup.ini files and provide the key used with setup's -K option, or use setup's -X option.

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 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.