blob: 86c982db03a0db776dae231438045894bdedd9fc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#!/bin/bash
function mirror_parent_channel() {
# This is not a general purpose tool. Do not use it as such.
#
# mirror_parent_channel http://example-conda.com/some-channel /some/path/to/store/it
#
# /some/path/to/store/it will end up looking like so:
#
# + it
# `- linux-64
# `- osx-64
# `- win-64
# `- noarch
# `- ...
#
local url="$1"
local dest="$2"
local _retval=
if [[ -z $url ]]; then
echo "URL required."
return 1
fi
if [[ -z $dest ]]; then
echo "Destination directory not defined."
return 1
fi
if [[ ! -d $dest ]]; then
mkdir -p "$dest"
fi
pushd "$dest" &>/dev/null
wget \
--no-verbose \
--timestamping \
--accept '*.bz2','*.json*' \
--recursive \
--no-parent \
--no-host-directories \
--cut-dirs=1 \
--level=2 \
"$url"
_retval=$?
popd &>/dev/null
return $_retval
}
mirror_parent_channel "$1" "$2"
|