]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
1 | #!/usr/bin/env bash |
2 | # Licensed to the Apache Software Foundation (ASF) under one | |
3 | # or more contributor license agreements. See the NOTICE file | |
4 | # distributed with this work for additional information | |
5 | # regarding copyright ownership. The ASF licenses this file | |
6 | # to you under the Apache License, Version 2.0 (the | |
7 | # "License"); you may not use this file except in compliance | |
8 | # with the License. You may obtain a copy of the License at | |
9 | # | |
10 | # http://www.apache.org/licenses/LICENSE-2.0 | |
11 | # | |
12 | # Unless required by applicable law or agreed to in writing, | |
13 | # software distributed under the License is distributed on an | |
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
15 | # KIND, either express or implied. See the License for the | |
16 | # specific language governing permissions and limitations | |
17 | # under the License. | |
18 | ||
19 | set -x | |
20 | ||
21 | if [ "$#" -ne 2 ]; then | |
22 | echo "Usage: $0 <apache tarball path> <target directory>" | |
23 | exit 1 | |
24 | fi | |
25 | ||
26 | tarball_path=$1 | |
27 | target_dir=$2 | |
28 | ||
29 | APACHE_MIRRORS=( | |
30 | "http://www.apache.org/dyn/closer.cgi?action=download&filename=" | |
31 | "https://downloads.apache.org" | |
32 | "https://apache.claz.org" | |
33 | "https://apache.cs.utah.edu" | |
34 | "https://apache.mirrors.lucidnetworks.net" | |
35 | "https://apache.osuosl.org" | |
36 | "https://ftp.wayne.edu/apache" | |
37 | "https://mirror.olnevhost.net/pub/apache" | |
38 | "https://mirrors.gigenet.com/apache" | |
39 | "https://mirrors.koehn.com/apache" | |
40 | "https://mirrors.ocf.berkeley.edu/apache" | |
41 | "https://mirrors.sonic.net/apache" | |
42 | "https://us.mirrors.quenda.co/apache" | |
43 | ) | |
44 | ||
45 | mkdir -p "${target_dir}" | |
46 | ||
47 | for mirror in ${APACHE_MIRRORS[*]} | |
48 | do | |
49 | curl -SL "${mirror}/${tarball_path}" | tar -xzf - -C "${target_dir}" | |
50 | if [ $? == 0 ]; then | |
51 | exit 0 | |
52 | fi | |
53 | done | |
54 | ||
55 | exit 1 |