설치된 패키지 목록은 cygcheck
과 함께 제공됩니다. Setup
는 목록 옵션을 허용하지 않지만 특정 -P
다음 코드 목록, -A
옵션과 함께 사용하면 에게 시스템에 존재하는 모든 패키지를 설치하기 위해 조작 된 cyg-reinstall-${Arch}.bat
배치 파일을 만듭니다 수 있습니다.
#!/bin/bash
# Create a batch file to reinstall using setup-{ARCH}.exe
# all packages reported as incomplete
print_error=1
if [ $# -eq 1 ]
then
if [ $1 == "-I" ]
then
lista=$(mktemp)
cygcheck -c | grep "Incomplete" > $lista
print_error=0
fi
if [ $1 == "-A" ]
then
lista=$(mktemp)
cygcheck -cd | sed -e "1,2d" > $lista
print_error=0
fi
fi
if [ $# -eq 2 ]
then
if [ $1 == "-f" ]
then
lista=$2
print_error=0
fi
fi
# error message if options are incorrect.
if [ $print_error -eq 1 ]
then
echo -n "Usage : " $(basename $0)
echo " [ -A | -I | -f filelist ]"
echo " create cyg-reinstall-{ARC}.bat from"
echo " options"
echo " -A : All packages as reported by cygcheck"
echo " -I : incomplete packages as reported by cygcheck"
echo " -f : packages in filelist (one per raw)"
exit 1
fi
if [ $(arch) == "x86_64" ]
then
A="x86_64"
else
A="x86"
fi
# writing header
echo -n -e "setup-${A}.exe " > cyg-reinstall-${A}.bat
# option -x remove and -P install
# for re-install packages we need both
if [ $1 == "-I" ]
then
awk 'BEGIN{printf(" -x ")} NR==1{printf $1}{printf ",%s", $1}' ${lista} >> cyg-reinstall-${A}.bat
fi
awk 'BEGIN{printf(" -P ")} NR==1{printf $1}{printf ",%s", $1} END { printf "\r\n pause "}' ${lista} >> cyg-reinstall-${A}.bat
# execution permission for the script
chmod +x cyg-reinstall-${A}.bat
귀하의 솔루션은 놀랍습니다! 내가 뭘 찾고 있었는지. 방금 만든 배치를 편집하여 즐겨 찾는 사이트'-s'와 LAN의 cygwin 로컬 패키지 -dir'-l'을 추가해야했습니다. 목록을 작성하기 전에 스크립트를 편집하여 목록을 작성하면 완료 될 것입니다. 왜냐하면이 시점에서 무인'-q'도 추가 될 수 있기 때문입니다. 또한 배치는 실행 파일 이름과 첫 번째 "-P"스위치 사이에 공백이 세 개인 것으로 생성되었지만 순수한 형식입니다. – Marco
나는 스크립트의 52 행 :'echo ...'에 local dir과 preferred local mirror와 같은 개인적인 설정을 추가했다. 그것은 매력처럼 작동합니다. – Marco