免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2377 | 回复: 1
打印 上一主题 下一主题

急,走过路过的都来瞧一瞧,看一看,帮忙修改下这个下载cygwin的脚本 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-11-11 10:37 |只看该作者 |倒序浏览
为了说明这个问题我引用一段文字:
引用自:
http://blog.hzgolf.com/?139/viewspace-748.html

用迅雷等工具下载cygwin软件包
上一篇 / 下一篇  2007-10-24 15:04:48

查看( 5 ) / 评论( 2 ) / 评分( 0 / 0 )
  大家都知道的事:我们的宽带是多么的“宽”!好在我们还能够求助于像迅雷,BitComet之类的下载工具。

  最近需要从fedora上回到windows,实在有些离不开linux强大的命令工具集,最好的办法当然是上cygwin。但是cygwin的安装程序实在是不适合我国国情,能够从网络安装成功的绝对少之又少。

  还是从网络搜搜cygwin的安装包方便,不过搜到的包太旧,还是想办法下份新的。google了下,发现一篇有用的文章:也谈下载Cygwin的安装包,实在是感谢这位作者(心气极),这里引用一下您的shell脚本:
#! /bin/sh
# This script. use to generate a download script. for cygwin !
#
# Usage : ./cyg_scratch.sh setup.ini
DEFAULT_SETUP_INI=setup.ini
BASE_MIRROR_SITE=http://www.cygwin.cn/pub/

## If the setup.ini specified ?
if [ -z $1 ] ; then
    SETUP_INI=$DEFAULT_SETUP_INI
else
    SETUP_INI=$1
fi

## If the SETUP_INI exists ?
if [ ! -f $SETUP_INI ] ; then
    echo "$SETUP_INI does not exists !"
    exit 0
fi

## Scratch the package file names in the setup.ini
for fname in `gawk '/^install^source:/ {print $2}' $SETUP_INI`
do
    wget -P `dirname $fname` $BASE_MIRROR_SITE$fname
## You can change to any statements to download the file you want.
#  `dirname $fname` : the directory prefix
#  
done

## END
这个方法是从setup.ini获取到软件包的链接,并用wget命令来下载。但是wget还是不够快啊,单进程下载太慢了,而且有时会停止响应。现在下载地址已经得到了,为什么不用迅雷来下载呢,于是我把
    wget -P `dirname $fname` $BASE_MIRROR_SITE$fname
修改成:
   echo $BASE_MIRROR_SITE$fname
并将结果定向到files.lst文件,然后启动迅雷,导入下载列表files.lst,这个速度实在是爽啊!1个多G文件一会儿工夫就搞定了。不过还有一个问题,下载下来的文件都在同一个目录(想从本地安装cygwin必须保持原来的目录结构)!

  办法也很简单:
#! /bin/sh

DOWNLOAD_DIR="/cygdrive/d/TDdownload/cygwin"
FILELIST=`cat files.lst`

for thefile in $FILELIST; do
   PACKAGE_DIR="release/"`dirname $thefile`
    mkdir -p$PACKAGE_DIR
    mv $DOWNLOAD_DIR"/"`basename $thefile`   $PACKAGE_DIR
done

请修改DOWNLOAD_DIR、PACKAGE_DIR,我这个脚本需要在release目录外执行。

注:先用cygwin的安装程序下载软件包,选择国内的镜像http://www.cygwin.cn/pub/,选择所有软件包,开始下载后点取消,会在setup.exe所在目录下的http%3a%2f%2fwww.cygwin.cn%2fpub%2f子目录里产生setup.ini文件,上面2个shell脚本都在这个子目录里执行。

windows下shell脚本用不来?先去下载个很小的cygwin安装包先安装下,不就可以用了。

请问PACKAGE_DIR这个变量怎么修改



[ 本帖最后由 277059367 于 2007-11-11 11:01 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2007-11-11 20:47 |只看该作者
2,到cygwin主页,镜像站点
打开台湾的ftp,很快的
1,在setup.exe里选台湾的镜像,晚上,很快的
3,注册表
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions]

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin]

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2]
"cygdrive prefix"="/cygdrive"
"cygdrive flags"=dword:00000022

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/]
"native"="d:\\cygwin"
"flags"=dword:0000000a

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin]
"native"="d:\\cygwin/bin"
"flags"=dword:0000000a

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib]
"native"="d:\\cygwin/lib"
"flags"=dword:0000000a

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\~]
"native"="d:\\cygwin/home/sbody"
"flags"=dword:0000000a

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options]

4,cygwin.bat
@echo  off
c:
set HOME=D:\cygwin\home\TheLORDD
d:
chdir D:\cygwin\home\TheLORDD
start rxvt -e bash

5,..........
Rxvt*path:~/.rxvt
Rxvt*menu:1.menu
Rxvt*geometry: 100x40
Rxvt*background: black
!Rxvt*foreground: #999933
Rxvt*foreground: #66CCFF

Rxvt*cursorColor: green

Rxvt*scrollColor: Blue
Rxvt*troughColor: Gray

Rxvt*scrollBar: True
Rxvt*scrollBar_right: True
Rxvt*scrollstyle:next

Rxvt*font: -*-courier-medium-r-*-*-16-140-*-75-*-*-*-*
Rxvt*boldFont: -*-courier-bold-r-*-*-17-140-*-75-*-*-*-*
Rxvt*colorUL: yellow
#Rxvt*multichar_encoding: gb

Rxvt*title: sashdasd
Rxvt*SaveLines: 1000
Rxvt*loginShell: True
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP