Skip to content

Instantly share code, notes, and snippets.

@takuya
Created December 13, 2012 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takuya/71a3f959b2cefb9f578e to your computer and use it in GitHub Desktop.
Save takuya/71a3f959b2cefb9f578e to your computer and use it in GitHub Desktop.
Cygwin の cygports を有効にしたり、無効にしたりを簡単に切り替える。 centos の enable-repo 的なことができないので、手動で切り替える。
#!/usr/bin/ruby
#coding: utf-8
require 'optparse'
iij = "http://ftp.iij.ad.jp/pub/cygwin/"
cygports = "ftp://ftp.cygwinports.org/pub/cygwinports"
target = nil
opt = OptionParser.new
opt.on("-d","--disable", "cygwin 標準(cygports無効)" ){|v| target = iij}
opt.on("-e","--enable", "cygports を有効にする"){|v| target = cygports}
opt.parse! ARGV
unless target then
ARGV = ["--help"]
opt.parse! ARGV
exit
end
#puts target
IO.foreach("|/usr/bin/apt-cyg -m #{target} update ") {|line|puts line}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment