How can I set up Cygwin to automatically update and download without the GUI?
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.
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 inx:\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:
- Cygwin Mailing List: Clone cygwin-setup settings from one PC to another
- Cygwin Mail Archive: question on backup
- Cygwin Mailing List: Automated cygwin install
- Cygwin Mailing List: Possible to copy whole cygwin folder to different machine?
- helix' blog: Install cygwin-packages from the cmdline
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-9]\.[0-9a-zA-Z]\+\.tar/-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:
- Cygwin Mailing List
- Code snippet on Snipplr: Sed script
- Blog Post: Install cygwin-packages from the cmdline
- Cygwin Mail Archive: question on backup
Here's an answer from superuser about doing an unattended update:
cd C:\cygwin
wget -N http://cygwin.com/setup.exe
setup.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode
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