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.
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.
These instructions 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:
- 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.
-
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 -
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 areleasedirectory and the compressedsetup.inifiles. Run Cygwin's setup program and type the URL of your server. -
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
rsynccommand periodically. The easiest way to do this is by putting it in yourcrontab.
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.
You can obtain the mksetupini script:
-
on Cygwin, by installing the
calmCygwin package, or -
directly from Cygwin-apps git.
pip3 install git+http://sourceware.org/git/cygwin-apps/calm.git
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.
-
Install
mksetupini, as described above. -
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 ../.. doneThat 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. - Add your custom package(s) to the directory tree.
- (Optional) Since packages in
Basecategory are always installed, you can add an empty package in theBasecategory that depends on several other packages to automatically install them for anyone using your custom mirror. For example:#!/bin/sh mkdir custompackage cd custompackage tar -Jcf custompackage-0.0.1-1.tar.xz --files-from /dev/null tar -Jcf custompackage-0.0.1-1-src.tar.xz --files-from /dev/null cat > custompackage-0.0.1-1.hint << EOF sdesc: "My favorite packages" ldesc: "My favorite packages" category: Base requires: bzip2 clear cygwin-doc file less openssh pinfo rxvt wget EOF -
Run
mksetupiniand create compressedsetup.inifiles 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 doneYou will see error messages frommksetupiniabout non-existent packages if you do not have a full mirror (or if you made an error in a.hintfile). - 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.
Creating an overlay Cygwin package server
Follow the the steps of "Creating a custom Cygwin package server" above, with the following modifications.
- Instead of copying/linking an existing Cygwin mirror, start with an empty directory.
-
Add the
--disable-check=missing-required-package,missing-depended-packageoption tomksetupini(this turns off checking that all dependencies can be found, since presumably some of them will be provided by the standard Cygwin package repository).(Additionally, if you are going to overlay an existing package with just a
test:version in your repository, you will need to use the--disable-check=missing-curroption to indicate that it's ok not to have acurr:version of a package) -
In setup's "Choose A Download Site" page, enter the URL of your repository in the "User URL" box, press "Add". Then ensure both that site and a Cygwin mirror site are selected.
If using the setup command line, use the
--siteoption once to specify a Cygwin mirror, and again to specify your overlay package server.
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: We are currently lacking a tool to check that cross-repository dependencies can be satisfied (i.e. that presumptive packages for these dependencies actually exist). This can be checked by running setup, telling it to install everything, and seeing if the "Resolving dependencies" page reports any dependencies as not found.
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.