I have a computer that has a Cygwin installation that has been customized over the years by installing additional packages as needed using Cygwin's setup program.

I'd like to duplicate this installation on a second computer, with the same set of packages installed.

How can I do this in a way that doesn't involve manually going through the list of installed packages on the first computer and entering it in the installation checkboxes on the second?

The two ways that I know of are to copy the directory of downloaded installation packages from the first computer and do an "install from disk" on the second, selecting everything -- but that will include packages that were installed and later removed, as well as what is currently installed. Alternately, the Google search I tried found suggestions to just copy the installation itself, which obviously will prevent setup.exe from later updating it because the information about what's installed will change. I suppose one plausible way would be to copy the actual installation and the configuration file for setup.exe that records what has been installed, if there isn't a cleaner way to do it, but I don't know what configuration information would need to be copied for this to work -- and I'd assume there has to be a better way, doesn't there?

(Addendum: I see from the answers to Cygwin package management how to dump a list of packages that are installed on the first computer, but not how to use the dumped file to duplicate the installation on the second.... Presumably it should be possible to take that dumped list and use it as input either to the -P option of setup or to pycmg, although that doesn't retain the same package versions and it's messy enough that I still would expect a better solution.)

I know this doesn't answer your question, but you could just install everything (perhaps manually excluding a few big packages that you know you don't want). If you have a decently sized hard drive, it will probably take less time and effort than you'd spend deciding weeding out what you don't want. Of course if the point is to exactly duplicate an existing system that doesn't help.
–
Keith ThompsonFeb 12 '12 at 0:38

When you say "the entire Cygwin directory", do you mean the directory it's installed into (containing bin, etc, and so forth), or the setup cache directory containing setup.ini and cached installation tarballs? If just the directory it's installed into, how does that work with the package management next time you upgrade?
–
Brooks MosesFeb 13 '12 at 5:48

Correct. The installed directory. I didn't have problems upgrading later, although I preferred to upgrade the original source and redeploy it internally from there. I also ran upgrades directly from the net against these copied images with no ill effects.
–
Tim BrighamFeb 13 '12 at 12:36

Thanks! I looked into this a bit more, and found that the information of what's installed is stored in /etc/setup, and so will get copied as part of the installed directory -- so it makes sense that future upgrades will work fine.
–
Brooks MosesFeb 15 '12 at 4:01