How to download individual cygwin packages (and/or individual files within them) without running cygwin's setup.exe on local system?

4

2

I only need specific files without cygwin environment. Is there a way for example to download latest version of some unix tools file, like for example grep.exe and latest cygwin1.exe file, and that's it.

Edit: I know that browsing is possible here : http://cygwin.com/packages/ , ok, but this list doesn't allow downloading.

rsk82

Posted 2011-12-11T15:43:16.677

Reputation: 1 272

Answers

6

I'm not aware of any standalone program that does this in an off-the-shelf manner without requiring larger chunks of Cygwin and its setup.exe (see edit at bottom if that's what you need). I think that all of the pieces are there to make a super-minimal install relatively easy to script.

There are two parts to this one: retrieving the files, and detecting version changes (if that's part of what you were looking for when you said "latest").

To retrieve specific files, you can examine (or sniff the requests made by) the Cygwin setup.exe installer/updater to determine where it retrieves individual files. Pick a mirror, navigate to pub/cygwin/release, and retrieve the files. For example, here's a link to the core cygwin packages directory for the OSU OSL mirror that I use.

I think that if your individual file (like grep.exe) is included within a specific package, you'll have to grab the whole package. Some third party out there might be providing unpacked individual files from Cygwin, but I would be reluctant to trust anyone but Cygwin and its official mirrors, so I recommend grabbing the whole packages from a trusted source, and then extracting the file that you need.

Determining when the files have been updated is trickier. Pseudocode would be something like:

  • Fetch current contents of subdirectory from mirror (using wget or similar). This syntax leaves the more-easily-parsed .listing file behind.

    wget --no-remove-listing ftp://cygwin.osuosl.org/pub/cygwin/release/grep/

  • Determine newest file that matches the expected filename pattern. I think that that if the file naming conventions are clean (which Cygwin's usually are), you could easily grab the most-recent version by breaking the numeric parts into tokens, and sorting numerically. You could do quick-and-dirty and just grab the last file in the .listing that matches, but that might put grep.2.tgz after grep.10.tgz, depending on sorting methods used.

  • Download and extract/unpack/unzip. Depending on what archiver you're using, you can probably tell it to only extract specific files.

  • Copy files to your desired destination.

You could schedule the script to check once a day/week/whatever. You'd probably also want to fetch the accompanying md5.sum file and compare checksums, depending on how important the files are to your use case.

Speaking of that, what is your use case? Do you just want grep without the other overhead, and keep it updated/patched? If not, my answer might need to be adjusted accordingly.

EDIT: You might also want to check out apt-cyg. I think that it may actually require a good bit of the core install framework, but the page says that it only requires bash, wget, tar, gawk and bzip2, so you might be able to get the dependencies working there.

I'm new, so I've run out of links, but this answer has apt-cyg info, and also how to do command-line installs with setup.exe.

Upgrading and installing packages through the Cygwin command-line?

Your question sort of implies that you might want something more stripped down than that question provides, so I'll leave the rest of my answer intact for folks who are looking for something even more minimal.

Royce Williams

Posted 2011-12-11T15:43:16.677

Reputation: 975

1The URL has since changed to ftp://cygwin.osuosl.org/pub/cygwin/<arch>/release/<package> where you should substitute <package> and <arch> as appropriate (x86 for 32 bit or x86_64 for 64 bit). – starfry – 2016-08-03T11:07:17.737

0

The simplest way to download (for example, the perl package) and/or sources, is to use one of:

  1. Using apt-cyg with: apt-cyg download perl.
  2. Using wget with:
    wget ftp://cygwin.osuosl.org/pub/cygwin/x86_64/release/perl/perl-5.26.3-1-src.tar.xz
  3. Using your browser: ftp://cygwin.osuosl.org/pub/cygwin/x86_64/release/perl/

This version of apt-cyg only requires: wget, ca-certificates, gnupg.

not2qubit

Posted 2011-12-11T15:43:16.677

Reputation: 1 234