Cygwin의 명령 줄에서 Cygwin을 업데이트하는 방법?


73

Cygwin에서 누락 된 패키지를 검색하고 다운로드하려면 매번 setup.exe GUI를 실행하고 여러 번 클릭하고 다른 지루한 작업을 수행해야합니다.

Cygwin의 명령 행에서 직접 동일한 작업을 수행 할 수있는 방법이 있습니까? apt-get 도구처럼.

답변:


40

여기를보세요 :

다른 것 외에도 다음과 같은 옵션 목록을 제공합니다 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

그렇게 setup.exe -P <package name>해야합니다. 여기 cygwin이 없으므로 예상대로 작동하는지 테스트하십시오.

패키지를 검색하려면 다음을 수행하십시오.

당신은 사용할 수 있습니다 cygcheck -p:

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

다음과 같은 출력을 생성합니다 (위 사이트의 예).

$ 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

9
주의 사항 : 업데이트가 교체 cygwin1.dll되면 Cygwin 프로그램이 제대로 작동하지 않으며 Cygwin 설명서에서 재부팅을 권장합니다. 따라서 모든 Cygwin 프로그램을 닫은 다음 setup.exe직접 실행하는 것이 가장 좋습니다 cmd(자동화하려면 셸 스크립트가 아닌 배치 파일을 사용하십시오).
— Gilles

감사! 내가 다운로드해야 할 패키지를 아직 모르기 때문에 검색 기능이 필요합니다. 나는 패키지의 전체 목록을 찾을 수 있습니다 일단 내가 할 수 grep는 적어도 ...
— 파벨 블라 소프

예제 편집을 참조하십시오.
— icyrock.com

22

모든 cygwin 구성 요소의 자동 업그레이드를 수행합니다.

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

cygwin1.dll으로 업그레이드하여 cygwin 앱이 오작동하지 않도록 업그레이드가 완료된 후 재부팅해야합니다

--no-desktop 데스크탑 바로 가기 생성 비활성화

--no-shortcuts 데스크탑 생성 및 시작 메뉴 비활성화

--no-startmenu 시작 메뉴 바로 가기 생성 비활성화

--quiet-mode 무인 설치 모드


각 명령의 기능을 설명하기 위해 답변을 확장 하시겠습니까?
— Raystafarian

9
이제 setup-x86_64.exe 또는 setup-x86.exe가 필요할 수 있습니다.
— drescherjm

cygwin 2.9에서는을 얻었 zsh: command not found: setup.exe지만 setup exe가 있습니다.
— Timo

당신이 사용하는 경우 no-shortcuts왜도 필요 no-desktop하고 no-startmenu?
— Hashim

매우 도움이, 나는 이것에 대해 몰랐어요. 설치할 패키지를 지정할 수도 있습니다 (시간 절약). 예를 보려면 여기를 참조하십시오 : gist.github.com/piotrpolak/c616455f1da8dfc2d4e101afbfdcdc8d
— Sridhar Sarnobat

10

다른 해결책은 GitHub 에서 사용 가능한 apt-cyg스크립트 를 사용하는 것 입니다.


3
cygwin 자체 업그레이드를 지원하지 않습니다.
— thoni56

@ThomasNilsson 왜 그렇게 생각하십니까?
— André Chalella

1
cygwin1.dll을 사용하여 쉘에서 실행 중이기 때문에. 물론 다른 쉘을 사용할 수도 있습니다.
— thoni56

"실제"질문은 업데이트되지 않았지만 "설정 UI를 사용하지 않고 하나의 패키지를 설치하는 방법"이며, 이것은 실제 답변입니다 ... 실제로, 설정보다 훨씬 낫습니다 -p cu cuz, 그것은 당신에게 무엇을 말해 줄 것입니까? 당신의 믿음을 맹목적으로 설정하지
— 말고 행동하십시오

7

Cygwin 설정 위치가 변경되어 분할 된 것 같습니다. 이제 당신은

wget http://cygwin.com/setup-x86.exe

또는

wget http://cygwin.com/setup-x86_64.exe

나는 내용으로 SETUP.BAT을 가지고 bin\wget.exe --timestamping http://www.cygwin.com/setup-x86_64.exe && start setup-x86_64.exe, 다음 박쥐 파일을 시작합니다 (즉 --timestamping가하는 일입니다) 난 항상 최신 설치 프로그램을 실행하고 새 버전이 실제로있을 경우에만 설치 프로그램을 다운로드 확인하고,
— hanshenrik

4

설치 할 수 있습니다 커맨드 라인 (에서을 상승 쉘 , 제발) :

setup-x86.exe --root c:\cygwin -q --upgrade-also

64 비트 버전의 경우 :

setup-x86_64.exe --root c:\cygwin -q --upgrade-also

세부:

  • 대체 c:\cygwin당신의 Cygwin에서의 루트 설치 디렉토리와 함께.
  • CygWin 셸 또는 프로그램을 닫을 것을 제안합니다 (예 : net stop sshdOpenSSH를 설치 한 경우).
  • 이 매개 변수 -q는 필수가 아닙니다.

GUI (DOS 셸) 또는 원격 콘솔 (SSH 또는 텔넷)을 통해 작동합니다. PowerShell에서 테스트되지 않았습니다 (누군가?).

올바른 업데이트 출력 예 :

G:\Instalac\CygWin\v2.852>Starting cygwin install, version 2.852
User has backup/restore rights
Current Directory: g:\Instalac\CygWin\Packages
Could not open service McShield for query, start and stop. McAfee may not be installed, or we don't have access.
root: c:\cygwin system
Selected local directory: g:\Instalac\CygWin\Packages
net: Direct
Loaded cached mirror list
get_url_to_membuf http://cygwin.com/mirrors.lst
getUrlToStream http://cygwin.com/mirrors.lst
site: http://ftp.hawo.stw.uni-erlangen.de/cygwin/
get_url_to_membuf http://ftp.hawo.stw.uni-erlangen.de/cygwin/x86/setup.bz2
getUrlToStream http://ftp.hawo.stw.uni-erlangen.de/cygwin/x86/setup.bz2
get_url_to_membuf http://ftp.hawo.stw.uni-erlangen.de/cygwin/x86/setup.bz2.sig
getUrlToStream http://ftp.hawo.stw.uni-erlangen.de/cygwin/x86/setup.bz2.sig
Changing gid back to original
Visited: 122 nodes out of 4415 while creating dependency order.
Dependency order of packages: _autorebase base-cygwin cygwin _update-info-dir libgcc1 libiconv2 libintl8 alternatives libattr1 li
bgmp10 coreutils libstdc++6 terminfo libncursesw10 libreadline7 bash findutils sed base-files libuuid1 libblkid1 libsmartcols1 zl
ib0 util-linux bashdb zlib-devel binutils libbz2_1 bzip2 libffi6 libp11-kit0 libtasn1_6 p11-kit p11-kit-trust ca-certificates cry
pt libmpfr4 gawk editrights libpcre1 grep libsigsegv2 diffutils csih cygrunsrv popt libpopt0 cygutils cygwin-devel dash file liba
tomic1 libcloog-isl4 libgomp1 libisl10 libmpc3 libquadmath0 libssp0 w32api-headers w32api-runtime windows-default-manifest gcc-co
re libexpat1 liblzma5 libdb4.8 libgdbm4 libopenssl100 libsqlite3_0 libcharset1 libiconv libintl-devel libuuid-devel python gdb li
bargp getent groff gzip hostname info ipc-utils libncurses10 less libapr1 libiodbc2 libmysqlclient18 libcom_err2 libkrb5support0
libk5crypto3 libkrb5_3 libgssapi_krb5_2 libsasl2_3 libopenldap2_4_2 perl openssl libpq5 libaprutil1 libedit0 libproxy1 libneon27
libpipeline1 libserf1_0 login lynx make man-db mintty nano ncurses openssh procps psmisc rebase run screen subversion xz tar tzco
de vim-minimal which zsh
Changing gid to Administrators
Ending cygwin install

업데이트 중에 다음과 같은 문제 가 발생한 경우 :

The following DLLs couldn't be rebased due to errors:
  /usr/bin/cygcrypt-0.dll

또는:

The following DLLs couldn't be rebased because they were in use:
  /usr/bin/cygcrypt-0.dll

또는:

ReBaseImage (/usr/bin/cygcrypt-0.dll) failed with last error = 6

... 설치 후 리베이스해야합니다.

모든 CygWin 쉘, 프로그램 및 서비스를 닫습니다. 관리자
권한으로 엽니 다 c:\CygWin\bin\ash.exe(높은 수준).
실행 /bin/rebaseall.


1
나를 위해 작동합니다. 감사. 최신 setup-x86.exe 또는 setup-x86_64.exe를 먼저 다운로드해야합니다. 그리고 cmd Run As Administrator 사용
— Marslo

2
모든 사용자를 위해 설치하지 않는 경우 (즉, cygwin root가 admin에게 쓰기를 요구하는 경우) 관리자로 또는 --root로 설정을 실행할 이유는 거의 없습니다. setup-86[_x64].exe -B현재 사용자로 실행합니다. 나중에 필요한 경우 cygrunsrv를 Windows 서비스로 설치하도록 상승시킬 수 있습니다.
— cowbert

1

나는 이것이 너무 오래 전에 필요하다고 느꼈다. 설치 파일을 계속 다운로드하여 설치하기 만하면되지만 가끔 Cygwin이 업데이트 될 때 설치 프로그램 파일이 오래되었습니다. 결국 자동으로 상승하고 설치 관리자를 다운로드하며 무인 업그레이드를 실행하는 Powershell 스크립트를 만들었습니다. 데스크탑에 설치 한 상태에서 마우스 오른쪽 버튼을 클릭하고 "Powershell로 실행"하면 모든 Cygwin 패키지를 전체 업그레이드 할 수 있습니다. 필요한 유일한 사용자 상호 작용은 UAC와 마지막에 "계속하려면 아무 키나 누르십시오"프롬프트입니다. 그러나 스크립트 일 뿐이므로 명령 줄에서도 실행할 수 있습니다.

나는 여기에 잠시 동안 코드를 가지고있다 : http://pastebin.com/wMRctAuL

아래에 복사했습니다. 나는 몇 가지 StackOverflow Q & A의 도움으로 그것을 썼습니다. :) 컴퓨터에서 로컬 Powershell 스크립트 를 활성화하기 만하면 실행할 수 있습니다 . 완벽한 Windows 네이티브 솔루션입니다.

# Get the ID and security principal of the current user account
$myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)

# Get the security principal for the Administrator role
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator

# Check to see if we are currently running "as Administrator"
if ($myWindowsPrincipal.IsInRole($adminRole)) {
   # We are running "as Administrator" - so change the title and background color to indicate this
   $Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevated)"
   $Host.UI.RawUI.BackgroundColor = "DarkBlue"
   clear-host
}
else {
   # We are not running "as Administrator" - so relaunch as administrator

   # Create a new process object that starts PowerShell
   $newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell";

   # Specify the current script path and name as a parameter
   $newProcess.Arguments = $myInvocation.MyCommand.Definition;

   # Indicate that the process should be elevated
   $newProcess.Verb = "runas";

   # Start the new process
   [System.Diagnostics.Process]::Start($newProcess);

   # Exit from the current, unelevated, process
   exit
}

# Run your code that needs to be elevated here
(new-object System.Net.WebClient).DownloadFile('http://cygwin.com/setup-x86_64.exe','setup-x86_64.exe')

if (!$?) {
   Write-Host "Something wrong happened when downloading the Cygwin installer."
   Write-Host -NoNewLine "Press any key to continue..."
   $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
   exit
}

$p = Start-Process .\setup-x86_64.exe -ArgumentList "--upgrade-also --quiet-mode" -wait -NoNewWindow -PassThru

if ($p.ExitCode -ne 0) {
   Write-Host "Cygwin setup failed with an error!"
}

Remove-Item .\setup-x86_64.exe

Write-Host -NoNewLine "Press any key to continue..."
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

0

@Johnny의 답변 https://superuser.com/a/624731/110335 에서 확장

내가 직면 한 성가심은 .ini 파일이 Cygwin의 setup.exe의 최신 버전이라는 메시지입니다.

자체 업데이트를 위해 다음 스크립트를 작성하고 필요한 모든 것을 비 대화식으로 업데이트했습니다.

cygwinSetup64.cmd

@echo on
cd /d e:\cygwin
move /y cygwinSetup-x86_64.exe   setup-x86_64.exe
wget --progress=dot -S -N  http://cygwin.com/setup-x86_64.exe
move /y  setup-x86_64.exe cygwinSetup-x86_64.exe 

cygwinSetup-x86_64.exe   --no-desktop --no-shortcuts --no-startmenu --quiet-mode


0

다음 내용이 포함 된 "cygwin-update.bat"와 같은 배치 파일을 만들어 경로에 넣으십시오.

@echo off
"%~dp0\gnubin\wget.exe" --no-check-certificate https://www.cygwin.com/setup-x86_64.exe -O C:\cygwin64\setup-x86_64.exe
cd /d C:\cygwin64
setup-x86_64.exe -q -g
당사 사이트를 사용함과 동시에 당사의 쿠키 정책과 개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.