Skip to content

Commit 416da5e

Browse files
author
rouson
committed
Fixed ftp behavior on Linux.
1 parent e8927d6 commit 416da5e

File tree

1 file changed

+39
-8
lines changed
  • install_prerequisites

1 file changed

+39
-8
lines changed

install_prerequisites/build

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ set_default_version()
129129
check_prerequisites()
130130
{
131131
if [[ "$package_to_build" == "gcc" && "$version_to_build" != "trunk" ]]; then
132-
gcc_fetch="ftp"
132+
gcc_fetch="ftp-url"
133133
else
134134
gcc_fetch="svn"
135135
fi
@@ -138,14 +138,14 @@ check_prerequisites()
138138
# See http://stackoverflow.com/questions/1494178/how-to-define-hash-tables-in-bash
139139
package_download_mechanism=(
140140
"gcc:$gcc_fetch"
141-
"wget:ftp"
141+
"wget:ftp-url"
142142
"cmake:wget"
143143
"mpich:wget"
144144
"flex:wget"
145-
"bison:wget"
145+
"bison:ftp-url"
146146
"pkg-config:wget"
147-
"make:ftp"
148-
"m4:ftp"
147+
"make:ftp-url"
148+
"m4:ftp-url"
149149
"subversion:wget"
150150
"_unknown:0"
151151
)
@@ -184,7 +184,7 @@ set_url()
184184
if [[ $package_to_build == 'cmake' ]]; then
185185
major_minor="${version_to_build%.*}"
186186
elif [[ "$package_to_build" == "gcc" && "$version_to_build" != "trunk" ]]; then
187-
gcc_url_head="http://ftpmirror.gnu.org/gcc/gcc-$version_to_build/"
187+
gcc_url_head="ftp.gnu.org:/gnu/gcc/gcc-$version_to_build"
188188
else
189189
gcc_url_head="svn://gcc.gnu.org/svn/gcc/"
190190
fi
@@ -196,7 +196,7 @@ set_url()
196196
"mpich;http://www.mpich.org/static/downloads/$version_to_build/"
197197
"flex;http://sourceforge.net/projects/flex/files/"
198198
"make;ftp://ftp.gnu.org/gnu/make/"
199-
"bison;http://ftp.gnu.org/gnu/bison/"
199+
"bison;ftp.gnu.org:/gnu/bison/"
200200
"cmake;http://www.cmake.org/files/v$major_minor/"
201201
"subversion;http://www.eu.apache.org/dist/subversion/"
202202
"_unknown;0"
@@ -257,6 +257,37 @@ set_url()
257257

258258
}
259259

260+
ftp-url()
261+
{
262+
ftp_mode=$1
263+
url=$2
264+
265+
text_before_colon="${url%%:*}"
266+
FTP_SERVER=$text_before_colon
267+
268+
text_after_colon="${url##*:}"
269+
text_after_final_slash="${text_after_colon##*/}"
270+
FILE_NAME=$text_after_final_slash
271+
272+
text_before_final_slash="${text_after_colon%/*}"
273+
FILE_PATH="$text_before_final_slash"
274+
275+
USERNAME=anonymous
276+
PASSWORD=""
277+
echo "$this_script: starting anonymous download: ftp $ftp_mode $FTP_SERVER... cd $FILE_PATH... get $FILE_NAME"
278+
279+
ftp $ftp_mode $FTP_SERVER <<Done-ftp
280+
user $USERNAME $PASSWORD
281+
cd $FILE_PATH
282+
passive
283+
binary
284+
get "$FILE_NAME"
285+
bye
286+
Done-ftp
287+
288+
echo "$this_script: finished anonymous ftp"
289+
}
290+
260291
# Download pkg-config if the tar ball is not already in the present working directory
261292
download_if_necessary()
262293
{
@@ -307,7 +338,7 @@ download_if_necessary()
307338
fi
308339
elif [[ "$fetch" == "wget" ]]; then
309340
args=--no-check-certificate
310-
elif [[ "$fetch" == "ftp" ]]; then
341+
elif [[ "$fetch" == "ftp-url" ]]; then
311342
args=-n
312343
elif [[ "$fetch" == "git" ]]; then
313344
args=clone

0 commit comments

Comments
 (0)