Cygwin automatic updates
Cygwin is a fantastic product for people that need to use Microsoft Windows and require some compatibility to Linux (or BSD or UNIX in general).
Unfortunately it is not trivial to keep it updated (and thus safe) as the update process requires downloading the latest installer and then clicking through the package list again and again on every update.
No apt-get update
, no emerge --update @world
, no dnf update
.
But ... the people at Red Hat (who now own Cygwin) are not mean, they are just not good at documenting things ...
Be sure to have wget installed via cygwin, you'll need it to fetch the installer automatically.
Then drop the following batch file as cyg_update.bat
into C:\cygwin64
(or where you have installed cygwin1):
- @echo off
- cd /d C:\cygwin64
- del /Q cygwinSetup-x86_64.exe
- bin\wget.exe --progress=dot -S -N http://cygwin.com/setup-x86_64.exe
- move /y setup-x86_64.exe cygwinSetup-x86_64.exe
- REM S-1-1-0 is the SID for "Everyone"
- icacls cygwinSetup-x86_64.exe /grant *S-1-1-0:RX
- cygwinSetup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode
Once you start the batch (e.g. by double-clicking from Windows Explorer) it will download the latest installer from Cygwin.com and perform a silent update.
You need to approve the Windows installer warning as you do with every manual install / update as well. So it's not a no-click update but a one-or-two-clicks update.
Still much better than the click fest without the batch file.
Update
01.06.2017: I've changed icacls cygwinSetup-x86_64.exe /grant Everyone:RX to icacls cygwinSetup-x86_64.exe /grant *S-1-1-0:RX which is the SID and not language dependent. 'cause otherwise German Windows would like to see "Jeder" and French "Tous publics", Chinese "任何人", etc. Looking them up on Microsoft's terminology search is quite nice but not really scalable.
-
If you have installed the 32bit version and/or used a different install path, adjust line 2 of the batch file accordingly. Did I need to say that? Hm, well, I did ... have a cookie. ↩
Comments
Display comments as Linear | Threaded
Alexandre Pierrot on :
Vielen Dank Daniel,
Mit Task Scheduler funktioniert es einfach perfekt!
[English: Many thanks, Daniel, using the task scheduler it works perfectly!]
Zabe Agha on :
I love this script but can't get it to work.
When running, from the command line, I get the following from executing the last line:
C:\cygwin>cygwinSetup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode Access is denied.
When launching from Explorer, I get:
Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item.
Any idea on how to get past this?
Daniel Lange on :
The line
icacls cygwinSetup-x86_64.exe /grant *S-1-1-0:RX
does not seem to work for you. Try to fix getting the executable permission on the file and you have found the issue.