How to update Cygwin from Cygwin's command line?

Take a look here:

  • http://cygwin.com/faq.html#faq.setup

Aside from the other things, it gives the following list of options to setup.exe:

Command Line Options:
 -A --disable-buggy-antivirus           Disable known or suspected buggy anti
                    virus software packages during execution.
 -C --categories                        Specify entire categories to install
 -D --download                          Download from internet
 -d --no-desktop                        Disable creation of desktop shortcut
 -h --help                              print help
 -K --pubkey                            Path to extra public key file (gpg format)
 -L --local-install                     Install from local directory
 -l --local-package-dir                 Local package directory
 -n --no-shortcuts                      Disable creation of desktop and start menu
                    shortcuts
 -N --no-startmenu                      Disable creation of start menu shortcut
 -O --only-site                         Ignore all sites except for -s
 -P --packages                          Specify packages to install
 -p --proxy                             HTTP/FTP proxy (host:port)
 -q --quiet-mode                        Unattended setup mode
 -r --no-replaceonreboot                Disable replacing in-use files on next
                    reboot.
 -R --root                              Root installation directory
 -S --sexpr-pubkey                      Extra public key in s-expr format
 -s --site                              Download site
 -U --keep-untrusted-keys               Use untrusted keys and retain all
 -u --untrusted-keys                    Use untrusted keys from last-extrakeys
 -X --no-verify                         Don't verify setup.ini signatures

So setup.exe -P <package name> should do the job. Don't have cygwin right here, so test it to confirm it works as expected.

To search for a package, per:

  • http://cygwin.com/cygwin-ug-net/using-utils.html#cygcheck

you can use cygcheck -p:

  cygcheck -p REGEXP
  ...
  -p, --package-query  search for REGEXP in the entire cygwin.com package
                       repository (requires internet connectivity)

which produces output like (example from above site):

$ cygcheck -p 'libexpat.*\.a'
Found 2 matches for 'libexpat.*\.a'.

expat-1.95.7-1            XML parser library written in C
expat-1.95.8-1            XML parser library written in C

This performs an unattended upgrade of all Cygwin components for 64-bit:

cd C:\cygwin
wget -N https://cygwin.com/setup-x86_64.exe
setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode

This performs an unattended upgrade of all cygwin components for 32-bit:

cd C:\cygwin
wget -N https://cygwin.com/setup-x86.exe
setup-x86.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

An alternate solution would be to use the apt-cyg script available on GitHub.

Tags:

Cygwin

Updates