From 29234a1afe74927a5163e92fe43f8e8c293636f4 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 25 Nov 2013 16:38:26 +0900 Subject: [PATCH] fix __download for cygwin --- shrc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/shrc b/shrc index 95ded63..17da7dc 100755 --- a/shrc +++ b/shrc @@ -221,7 +221,7 @@ __download(){ # download if type wget >/dev/null 2>&1 then - wget "$1" -O "$2" + wget $__my_wget_options "$1" -O "$2" elif type curl >/dev/null 2>&1 then curl --url "$1" --output "$2" @@ -231,10 +231,14 @@ __download(){ __mysetup_fetch_script(){ url="$1" name="$2" - type "$name" >/dev/null 2>&1 || { - __download "$url" "$HOME/.local/bin/$name" && - chmod u+x "$HOME/.local/bin/$name" - } + dst="$HOME/.local/bin/$name" + type "$name" >/dev/null 2>&1 && return + if __download "$url" "$dst" + then + chmod u+x "$dst" + else + test -f "$dst" && rm -- "$dst" + fi } __mysetup_darwin_set_defaults(){ @@ -443,7 +447,10 @@ __safe_alias htags="htags --xhtml --symbol --line-number \ __safe_alias au=aunpack __safe_alias lv="lv|less" __safe_alias rs="rsync --progress --itemize-changes --compress" -iscygwin && __safe_alias wget="wget --no-check-certificate" +iscygwin && { + __my_wget_options=" --no-check-certificate" + __safe_alias wget="wget $__my_wget_options" +} isdarwin && alias updatedb="LC_ALL=C updatedb" # do not use locate installed by macports