Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow upgrades without using setup*.exe. Addresses #22. #88

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

ilatypov
Copy link

@ilatypov ilatypov commented May 30, 2016

I adjusted the script to rely on the smaller interpreter (dash) and to upgrade all packages without using setup*.exe (should address #22 ). Using setup*.exe would bring up the GUI, preventing from remote invocation. Instead, the script copies the main directories to a secondary root, downloads, unpacks package updates into that secondary root. A subsequent invocation from the secondary root will be able to update the primary root. In the absence of chroot, we still need to invoke post-install scripts in-place in a final invocation in the primary root.

ilatypov and others added 22 commits May 30, 2016 20:04
…irectory throughout the script, except when queried or set with apt-cache.
…r balls. Skip downloading, checksumming whenever possible. Enable an experimental 4-stage upgrade that uses a secondary root to separate the long installation process from swapping with subdirectories in the original root. This may still stall in installing to the secondary root as this still uses an in-place upgrade.
@ilatypov ilatypov changed the title Emulate wget in all cases. Fixes #87. Allow upgrades without using setup*.exe. Addresses #22. Mar 3, 2017
@ilatypov ilatypov mentioned this pull request Mar 3, 2017
@alphapapa
Copy link

I saw your comment. I'm not sure I understand how this works. Do you mean it copies the entire Cygwin root recursively?

@ilatypov
Copy link
Author

ilatypov commented Mar 5, 2017

Yes, the added commands copy the existing top-level directories except the mount points in usr to a secondary root. A subsequent invocation will start ash in the secondary root and copy the secondary top level directories to the original root.

@ilatypov
Copy link
Author

ilatypov commented Nov 16, 2017

Unfortunately, adding consistency to apt-cyg did not rectify Cygwin's base address issue . Meaning that after some time "apt-cyg install PACKAGE_NAME" will either fail to find the package version frozen in the package list on disk or, if we update the package list with "apt-cyg update", may start updating the package's requisites such as "bash" and "cygwin", and this will result in the prominent Cygwin fork error.

Before I forget, the following CMD code runs Cygwin's setup-x86_64.exe to install a basic Cygwin image. This assumes that all Cygwin processes terminated before running the code.

set croot=e:\cygwin64
rd /s /q %croot%
powershell "Invoke-WebRequest -Uri 'http://cygwin.com/setup-x86_64.exe' -OutFile '%croot%\setup-x86_64.exe'"
%croot%\setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --no-admin --root %croot% --local-package-dir %croot%\install --upgrade-also --site http://mirrors.kernel.org/sourceware/cygwin/ --verbose --packages bash,curl,wget,subversion,git,openssh,unzip,zip

@andykimpe
Copy link

andykimpe commented Jun 17, 2024

not everyone has powershell

set croot=e:\cygwin64
rd /s /q %croot%
rem Windows has no built-in wget or curl, so we generate a VBS script to do the same
set DLOAD_SCRIPT=%TEMP%\download-%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs
echo Option Explicit                                                    >  %DLOAD_SCRIPT%
echo Dim args, http, fileSystem, adoStream, url, target, status         >> %DLOAD_SCRIPT%
echo.                                                                   >> %DLOAD_SCRIPT%
echo Set args = Wscript.Arguments                                       >> %DLOAD_SCRIPT%
echo Set http = CreateObject("WinHttp.WinHttpRequest.5.1")              >> %DLOAD_SCRIPT%
echo url = args(0)                                                      >> %DLOAD_SCRIPT%
echo target = args(1)                                                   >> %DLOAD_SCRIPT%
echo WScript.Echo "Getting '" ^& target ^& "' from '" ^& url ^& "'..."  >> %DLOAD_SCRIPT%
echo.                                                                   >> %DLOAD_SCRIPT%
echo http.Open "GET", url, False                                        >> %DLOAD_SCRIPT%
echo http.Send                                                          >> %DLOAD_SCRIPT%
echo status = http.Status                                               >> %DLOAD_SCRIPT%
echo.                                                                   >> %DLOAD_SCRIPT%
echo If status ^<^> 200 Then                                            >> %DLOAD_SCRIPT%
echo    WScript.Echo "FAILED to download: HTTP Status " ^& status       >> %DLOAD_SCRIPT%
echo    WScript.Quit 1                                                  >> %DLOAD_SCRIPT%
echo End If                                                             >> %DLOAD_SCRIPT%
echo.                                                                   >> %DLOAD_SCRIPT%
echo Set adoStream = CreateObject("ADODB.Stream")                       >> %DLOAD_SCRIPT%
echo adoStream.Open                                                     >> %DLOAD_SCRIPT%
echo adoStream.Type = 1                                                 >> %DLOAD_SCRIPT%
echo adoStream.Write http.ResponseBody                                  >> %DLOAD_SCRIPT%
echo adoStream.Position = 0                                             >> %DLOAD_SCRIPT%
echo.                                                                   >> %DLOAD_SCRIPT%
echo Set fileSystem = CreateObject("Scripting.FileSystemObject")        >> %DLOAD_SCRIPT%
echo If fileSystem.FileExists(target) Then fileSystem.DeleteFile target >> %DLOAD_SCRIPT%
echo adoStream.SaveToFile target                                        >> %DLOAD_SCRIPT%
echo adoStream.Close                                                    >> %DLOAD_SCRIPT%
echo.                                                                   >> %DLOAD_SCRIPT%
rem download cygwin
cscript /nologo %DLOAD_SCRIPT% https://cygwin.com/setup-x86_64.exe %croot%\setup-x86_64.exe
rem Install base cygwin
%croot%\setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --no-admin --root %croot% --local-package-dir %croot%\install --upgrade-also --site http://mirrors.kernel.org/sourceware/cygwin/ --verbose --packages bash,curl,wget,subversion,git,openssh,unzip,zip

ps pull rejected for me change bash by ash not alowed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants