How can I set up Cygwin to automatically update and download without the GUI?

How can I set up Cygwin to automatically update itself?

How can I get Cygwin to download a package without having to go via the GUI thing?

-
Cygwin runs on Windows; this probably belongs on SU – Michael Mrozek Sep 7 '10 at 2:36
Urgh. Cygwin is a version of Unix. – delete Sep 7 '10 at 2:45
I know a good number of people that would cry hearing "Cygwin is a version of Unix", but I guess we'll go with it – Michael Mrozek Sep 7 '10 at 2:55

Cygwin : Unix :: Peaches : Trombone (that was on my GRE ;)

Given how dramatic Cygwin changes can be, I'd be really wary of having it done without my explicit consent. If you are daring, you could invoke cron to run whatever update script you might choose.

If you were looking for the ill-documented setup.exe --quiet-mode for unattended operation, there it is.

-

cd C:\cygwin
wget -N http://cygwin.com/setup.exe


You should reboot after the upgrade is completed to prevent cygwin apps from misbehaving due to upgraded cygwin1.dll

--no-desktop Disable creation of desktop shortcut

--no-shortcuts Disable creation of desktop and start menu

--no-startmenu Disable creation of start menu shortcut

--quiet-mode Unattended setup mode

-

Automating Cygwin Installation

Source: This Wiki Page

The Cygwin Setup program is designed to be interactive, but there are a few different ways to automate it. If you are deploying to multiple systems, the best way is to run through a full installation once, saving the entire downloaded package tree. Then, on target systems, run setup.exe as a "Local Install" pointed at your downloaded package tree. You could do this non-interactively with the command line options setup.exe -q -L -l x:\cygwin-local\, where your downloaded package tree is in x:\cygwin-local\ (see the next FAQ for an explanation of those options.)

For other options, search the mailing lists with terms such as cygwin automated setup or automated cygwin install.

I have found some of the key places where this is discussed:

You may want to look into using cygcheck as well.

Also: I have not tested this myself, but there is now a project called apt-cyg which looks like it works in a similar way to debian's apt-get. Here is the project page

Copy Cygwin Packages to a New System

Here is an easy way I've found to duplicate an installation to multiple systems with updated packages upon install time:

#Save some copies of the /etc/setup/installed.db file
cp /etc/setup/installed.db ~/installed.db.bak
cp /etc/setup/installed.db ~/installed.db
#Create a sed script to zero version numbers
cat > ~/zero-version-nums.sed<<-'EOM'
s/-[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9a-zA-Z]\+-[0-9]\+\.tar/-0.0.0.0-0.tar/
s/-[0-9]\+\.[0-9]\+\.[0-9a-zA-Z]\+-[0-9]\+\.tar/-0.0.0-0.tar/
s/-[0-9]\+\.[_+0-9a-zA-Z]\+-[0-9]\+\.tar/-0.0-0.tar/
s/-[0-9a-zA-Z]\+-[0-9]\+\.tar/-0-0.tar/
s/-[0-9]\+\.tar/-0.tar/
EOM
# Change all version numbers to 0 (run sed script)
sed -i -f ~/zero-version-nums.sed ~/installed.db


Now simply copy this file to the new machine in C:\cygwin\etc\setup\installed.db, and run the Setup.exe installer. The packages listed should be automatically selected for update. It may be possible to automate this process using the tips I mentioned above, and here.

Sources:

-