functions-ftp.sh revision 210036
1#!/bin/sh 2#- 3# Copyright (c) 2010 iXsystems, Inc. All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright 9# notice, this list of conditions and the following disclaimer. 10# 2. Redistributions in binary form must reproduce the above copyright 11# notice, this list of conditions and the following disclaimer in the 12# documentation and/or other materials provided with the distribution. 13# 14# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24# SUCH DAMAGE. 25# 26# $FreeBSD: head/usr.sbin/pc-sysinstall/backend/functions-ftp.sh 210036 2010-07-13 23:47:12Z imp $ 27 28# Functions which runs commands on the system 29 30. ${BACKEND}/functions.sh 31. ${BACKEND}/functions-parse.sh 32 33MAIN_FTP_SERVERS="\ 34Main Site: ftp.freebsd.org" 35 36IPV6_FTP_SERVERS="\ 37IPv6 Main Site: ftp.freebsd.org|\ 38IPv6 Ireland: ftp3.ie.freebsd.org|\ 39IPv6 Israel: ftp.il.freebsd.org|\ 40IPv6 Japan: ftp2.jp.freebsd.org|\ 41IPv6 USA: ftp4.us.freebsd.org|\ 42IPv6 Turkey: ftp2.tr.freebsd.org" 43 44PRIMARY_FTP_SERVERS="\ 45Primary: ftp1.freebsd.org|\ 46Primary #2: ftp2.freebsd.org|\ 47Primary #3: ftp3.freebsd.org|\ 48Primary #4: ftp4.freebsd.org|\ 49Primary #5: ftp5.freebsd.org|\ 50Primary #6: ftp6.freebsd.org|\ 51Primary #7: ftp7.freebsd.org|\ 52Primary #8: ftp8.freebsd.org|\ 53Primary #9: ftp9.freebsd.org|\ 54Primary #10: ftp10.freebsd.org|\ 55Primary #11: ftp11.freebsd.org|\ 56Primary #12: ftp12.freebsd.org|\ 57Primary #13: ftp13.freebsd.org|\ 58Primary #14: ftp14.freebsd.org" 59 60ARGENTINA_FTP_SERVERS="\ 61Argentina: ftp.ar.freebsd.org" 62 63AUSTRALIA_FTP_SERVERS="\ 64Australia: ftp.au.freebsd.org|\ 65Australia #2: ftp2.au.freebsd.org|\ 66Australia #3: ftp3.au.freebsd.org" 67 68AUSTRIA_FTP_SERVERS="\ 69Austria: ftp.at.freebsd.org|\ 70Austria #2: ftp2.at.freebsd.org" 71 72BRAZIL_FTP_SERVERS="\ 73Brazil: ftp.br.freebsd.org|\ 74Brazil #2: ftp2.br.freebsd.org|\ 75Brazil #3: ftp3.br.freebsd.org|\ 76Brazil #4: ftp4.br.freebsd.org|\ 77Brazil #5: ftp5.br.freebsd.org|\ 78Brazil #6: ftp6.br.freebsd.org|\ 79Brazil #7: ftp7.br.freebsd.org" 80 81CANADA_FTP_SERVERS="\ 82Canada: ftp.ca.freebsd.org" 83 84CHINA_FTP_SERVERS="\ 85China: ftp.cn.freebsd.org|\ 86China #2: ftp2.cn.freebsd.org" 87 88CROATIA_FTP_SERVERS="\ 89Croatia: ftp.hr.freebsd.org" 90 91CZECH_REPUBLIC_FTP_SERVERS="\ 92Czech Republic: ftp.cz.freebsd.org" 93 94DENMARK_FTP_SERVERS="\ 95Denmark: ftp.dk.freebsd.org|\ 96Denmark #2: ftp2.dk.freebsd.org" 97 98ESTONIA_FTP_SERVERS="\ 99Estonia: ftp.ee.freebsd.org" 100 101FINLAND_FTP_SERVERS="\ 102Finland: ftp.fi.freebsd.org" 103 104FRANCE_FTP_SERVERS="\ 105France: ftp.fr.freebsd.org|\ 106France #2: ftp2.fr.freebsd.org|\ 107France #3: ftp3.fr.freebsd.org|\ 108France #5: ftp5.fr.freebsd.org|\ 109France #6: ftp6.fr.freebsd.org|\ 110France #8: ftp8.fr.freebsd.org" 111 112GERMANY_FTP_SERVERS="\ 113Germany: ftp.de.freebsd.org|\ 114Germany #2: ftp2.de.freebsd.org|\ 115Germany #3: ftp3.de.freebsd.org|\ 116Germany #4: ftp4.de.freebsd.org|\ 117Germany #5: ftp5.de.freebsd.org|\ 118Germany #6: ftp6.de.freebsd.org|\ 119Germany #7: ftp7.de.freebsd.org|\ 120Germany #8: ftp8.de.freebsd.org" 121 122GREECE_FTP_SERVERS="\ 123Greece: ftp.gr.freebsd.org|\ 124Greece #2: ftp2.gr.freebsd.org" 125 126HUNGARY_FTP_SERVERS="\ 127Hungary: ftp.hu.freebsd.org" 128 129ICELAND_FTP_SERVERS="\ 130Iceland: ftp.is.freebsd.org" 131 132IRELAND_FTP_SERVERS="\ 133Ireland: ftp.ie.freebsd.org|\ 134Ireland #2: ftp2.ie.freebsd.org|\ 135Ireland #3: ftp3.ie.freebsd.org" 136 137ISRAEL_FTP_SERVERS="\ 138Israel: ftp.il.freebsd.org" 139 140ITALY_FTP_SERVERS="\ 141Italy: ftp.it.freebsd.org" 142 143JAPAN_FTP_SERVERS="\ 144Japan: ftp.jp.freebsd.org|\ 145Japan #2: ftp2.jp.freebsd.org|\ 146Japan #3: ftp3.jp.freebsd.org|\ 147Japan #4: ftp4.jp.freebsd.org|\ 148Japan #5: ftp5.jp.freebsd.org|\ 149Japan #6: ftp6.jp.freebsd.org|\ 150Japan #7: ftp7.jp.freebsd.org|\ 151Japan #8: ftp8.jp.freebsd.org|\ 152Japan #9: ftp9.jp.freebsd.org" 153 154KOREA_FTP_SERVERS="\ 155Korea: ftp.kr.freebsd.org|\ 156Korea #2: ftp2.kr.freebsd.org" 157 158LITHUANIA_FTP_SERVERS="\ 159Lithuania: ftp.lt.freebsd.org" 160 161NETHERLANDS_FTP_SERVERS="\ 162Netherlands: ftp.nl.freebsd.org|\ 163Netherlands #2: ftp2.nl.freebsd.org" 164 165NORWAY_FTP_SERVERS="\ 166Norway: ftp.no.freebsd.org|\ 167Norway #3: ftp3.no.freebsd.org" 168 169POLAND_FTP_SERVERS="\ 170Poland: ftp.pl.freebsd.org|\ 171Poland #2: ftp2.pl.freebsd.org|\ 172Poland #5: ftp5.pl.freebsd.org" 173 174PORTUGAL_FTP_SERVERS="\ 175Portugal: ftp.pt.freebsd.org|\ 176Portugal #2: ftp2.pt.freebsd.org|\ 177Portugal #4: ftp4.pt.freebsd.org" 178 179ROMANIA_FTP_SERVERS="\ 180Romania: ftp.ro.freebsd.org" 181 182RUSSIA_FTP_SERVERS="\ 183Russia: ftp.ru.freebsd.org|\ 184Russia #2: ftp2.ru.freebsd.org|\ 185Russia #3: ftp3.ru.freebsd.org|\ 186Russia #4: ftp4.ru.freebsd.org" 187 188SINGAPORE_FTP_SERVERS="\ 189Singapore: ftp.sg.freebsd.org" 190 191SLOVAK_REPUBLIC_FTP_SERVERS="\ 192Slovak Republic: ftp.sk.freebsd.org" 193 194SLOVENIA_FTP_SERVERS="\ 195Slovenia: ftp.si.freebsd.org|\ 196Slovenia #2: ftp2.si.freebsd.org" 197 198SOUTH_AFRICA_FTP_SERVERS="\ 199South Africa: ftp.za.freebsd.org|\ 200South Africa #2: ftp2.za.freebsd.org|\ 201South Africa #3: ftp3.za.freebsd.org|\ 202South Africa #4: ftp4.za.freebsd.org" 203 204SPAIN_FTP_SERVERS="\ 205Spain: ftp.es.freebsd.org|\ 206Spain #2: ftp2.es.freebsd.org|\ 207Spain #3: ftp3.es.freebsd.org" 208 209SWEDEN_FTP_SERVERS="\ 210Sweden: ftp.se.freebsd.org|\ 211Sweden #2: ftp2.se.freebsd.org|\ 212Sweden #3: ftp3.se.freebsd.org|\ 213Sweden #5: ftp5.se.freebsd.org" 214 215SWITZERLAND_FTP_SERVERS="\ 216Switzerland: ftp.ch.freebsd.org|\ 217Switzerland #2: ftp2.ch.freebsd.org" 218 219TAIWAN_FTP_SERVERS="\ 220Taiwan: ftp.tw.freebsd.org|\ 221Taiwan #2: ftp2.tw.freebsd.org|\ 222Taiwan #3: ftp3.tw.freebsd.org|\ 223Taiwan #4: ftp4.tw.freebsd.org|\ 224Taiwan #6: ftp6.tw.freebsd.org|\ 225Taiwan #11: ftp11.tw.freebsd.org" 226 227TURKEY_FTP_SERVERS="\ 228Turkey: ftp.tr.freebsd.org|\ 229Turkey #2: ftp2.tr.freebsd.org" 230 231UK_FTP_SERVERS="\ 232UK: ftp.uk.freebsd.org|\ 233UK #2: ftp2.uk.freebsd.org|\ 234UK #3: ftp3.uk.freebsd.org|\ 235UK #4: ftp4.uk.freebsd.org|\ 236UK #5: ftp5.uk.freebsd.org|\ 237UK #6: ftp6.uk.freebsd.org" 238 239UKRAINE_FTP_SERVERS="\ 240Ukraine: ftp.ua.freebsd.org|\ 241Ukraine #2: ftp2.ua.freebsd.org|\ 242Ukraine #5: ftp5.ua.freebsd.org|\ 243Ukraine #6: ftp6.ua.freebsd.org|\ 244Ukraine #7: ftp7.ua.freebsd.org|\ 245Ukraine #8: ftp8.ua.freebsd.org" 246 247USA_FTP_SERVERS="\ 248USA #1: ftp1.us.freebsd.org|\ 249USA #2: ftp2.us.freebsd.org|\ 250USA #3: ftp3.us.freebsd.org|\ 251USA #4: ftp4.us.freebsd.org|\ 252USA #5: ftp5.us.freebsd.org|\ 253USA #6: ftp6.us.freebsd.org|\ 254USA #7: ftp7.us.freebsd.org|\ 255USA #8: ftp8.us.freebsd.org|\ 256USA #9: ftp9.us.freebsd.org|\ 257USA #10: ftp10.us.freebsd.org|\ 258USA #11: ftp11.us.freebsd.org|\ 259USA #12: ftp12.us.freebsd.org|\ 260USA #13: ftp13.us.freebsd.org|\ 261USA #14: ftp14.us.freebsd.org|\ 262USA #15: ftp15.us.freebsd.org" 263 264show_mirrors() 265{ 266 MIRRORS="${1}" 267 if [ -n "${MIRRORS}" ] 268 then 269 SAVE_IFS="${IFS}" 270 IFS="|" 271 for m in ${MIRRORS} 272 do 273 echo "$m" 274 done 275 IFS="${SAVE_IFS}" 276 fi 277} 278 279get_ftp_mirrors() 280{ 281 COUNTRY="${1}" 282 if [ -n "$COUNTRY" ] 283 then 284 COUNTRY=`echo $COUNTRY|tr A-Z a-z` 285 case "${COUNTRY}" in 286 argentina*) VAL="${ARGENTINA_FTP_SERVERS}" ;; 287 australia*) VAL="${AUSTRALIA_FTP_SERVERS}" ;; 288 austria*) VAL="${AUSTRIA_FTP_SERVERS}" ;; 289 brazil*) VAL="${BRAZIL_FTP_SERVERS}" ;; 290 canada*) VAL="${CANADA_FTP_SERVERS}" ;; 291 china*) VAL="${CHINA_FTP_SERVERS}" ;; 292 croatia*) VAL="${CROATIA_FTP_SERVERS}" ;; 293 czech*) VAL="${CZECH_REPUBLIC_FTP_SERVERS}" ;; 294 denmark*) VAL="${DENMARK_FTP_SERVERS}" ;; 295 estonia*) VAL="${ESTONIA_FTP_SERVERS}" ;; 296 finland*) VAL="${FINLAND_FTP_SERVERS}" ;; 297 france*) VAL="${FRANCE_FTP_SERVERS}" ;; 298 germany*) VAL="${GERMANY_FTP_SERVERS}" ;; 299 greece*) VAL="${GREECE_FTP_SERVERS}" ;; 300 hungary*) VAL="${HUNGARY_FTP_SERVERS}" ;; 301 iceland*) VAL="${ICELAND_FTP_SERVERS}" ;; 302 ireland*) VAL="${IRELAND_FTP_SERVERS}" ;; 303 israel*) VAL="${ISRAEL_FTP_SERVERS}" ;; 304 italy*) VAL="${ITALY_FTP_SERVERS}" ;; 305 japan*) VAL="${JAPAN_FTP_SERVERS}" ;; 306 korea*) VAL="${KOREA_FTP_SERVERS}" ;; 307 lithuania*) VAL="${LITHUANIA_FTP_SERVERS}" ;; 308 netherlands*) VAL="${NETHERLANDS_FTP_SERVERS}" ;; 309 norway*) VAL="${NORWAY_FTP_SERVERS}" ;; 310 poland*) VAL="${POLAND_FTP_SERVERS}" ;; 311 portugal*) VAL="${PORTUGAL_FTP_SERVERS}" ;; 312 romania*) VAL="${ROMAINIA_FTP_SERVERS}" ;; 313 russia*) VAL="${RUSSIA_FTP_SERVERS}" ;; 314 singapore*) VAL="${SINGAPORE_FTP_SERVERS}" ;; 315 slovak*) VAL="${SLOVAK_REPUBLIC_FTP_SERVERS}" ;; 316 slovenia*) VAL="${SLOVENIA_FTP_SERVERS}" ;; 317 *africa*) VAL="${SOUTH_AFRICA_FTP_SERVERS}" ;; 318 spain*) VAL="${SPAIN_FTP_SERVERS}" ;; 319 sweden*) VAL="${SWEDEN_FTP_SERVERS}" ;; 320 switzerland*) VAL="${SWITZERLAND_FTP_SERVERS}" ;; 321 taiwan*) VAL="${TAIWAN_FTP_SERVERS}" ;; 322 turkey*) VAL="${TURKEY_FTP_SERVERS}" ;; 323 ukraine*) VAL="${UKRAINE_FTP_SERVERS}" ;; 324 uk*) VAL="${UK_FTP_SERVERS}" ;; 325 usa*) VAL="${USA_FTP_SERVERS}" ;; 326 esac 327 else 328 VAL="${MAIN_FTP_SERVERS}" 329 VAL="${VAL}|${IPV6_FTP_SERVERS}" 330 VAL="${VAL}|${PRIMARY_FTP_SERVERS}" 331 VAL="${VAL}|${ARGENTINA_FTP_SERVERS}" 332 VAL="${VAL}|${AUSTRALIA_FTP_SERVERS}" 333 VAL="${VAL}|${AUSTRIA_FTP_SERVERS}" 334 VAL="${VAL}|${BRAZIL_FTP_SERVERS}" 335 VAL="${VAL}|${CANADA_FTP_SERVERS}" 336 VAL="${VAL}|${CHINA_FTP_SERVERS}" 337 VAL="${VAL}|${CROATIA_FTP_SERVERS}" 338 VAL="${VAL}|${CZECH_REPUBLIC_FTP_SERVERS}" 339 VAL="${VAL}|${DENMARK_FTP_SERVERS}" 340 VAL="${VAL}|${ESTONIA_FTP_SERVERS}" 341 VAL="${VAL}|${FINLAND_FTP_SERVERS}" 342 VAL="${VAL}|${FRANCE_FTP_SERVERS}" 343 VAL="${VAL}|${GERMANY_FTP_SERVERS}" 344 VAL="${VAL}|${GREECE_FTP_SERVERS}" 345 VAL="${VAL}|${HUNGARY_FTP_SERVERS}" 346 VAL="${VAL}|${ICELAND_FTP_SERVERS}" 347 VAL="${VAL}|${IRELAND_FTP_SERVERS}" 348 VAL="${VAL}|${ISRAEL_FTP_SERVERS}" 349 VAL="${VAL}|${ITALY_FTP_SERVERS}" 350 VAL="${VAL}|${JAPAN_FTP_SERVERS}" 351 VAL="${VAL}|${KOREA_FTP_SERVERS}" 352 VAL="${VAL}|${LITHUANIA_FTP_SERVERS}" 353 VAL="${VAL}|${NETHERLANDS_FTP_SERVERS}" 354 VAL="${VAL}|${NORWAY_FTP_SERVERS}" 355 VAL="${VAL}|${POLAND_FTP_SERVERS}" 356 VAL="${VAL}|${PORTUGAL_FTP_SERVERS}" 357 VAL="${VAL}|${ROMANIA_FTP_SERVERS}" 358 VAL="${VAL}|${RUSSIA_FTP_SERVERS}" 359 VAL="${VAL}|${SINGAPORE_FTP_SERVERS}" 360 VAL="${VAL}|${SLOVAK_REPUBLIC_FTP_SERVERS}" 361 VAL="${VAL}|${SLOVENIA_FTP_SERVERS}" 362 VAL="${VAL}|${SOUTH_AFRICA_FTP_SERVERS}" 363 VAL="${VAL}|${SPAIN_FTP_SERVERS}" 364 VAL="${VAL}|${SWEDEN_FTP_SERVERS}" 365 VAL="${VAL}|${SWITZERLAND_FTP_SERVERS}" 366 VAL="${VAL}|${TAIWAN_FTP_SERVERS}" 367 VAL="${VAL}|${TURKEY_FTP_SERVERS}" 368 VAL="${VAL}|${UKRAINE_FTP_SERVERS}" 369 VAL="${VAL}|${UK_FTP_SERVERS}" 370 VAL="${VAL}|${USA_FTP_SERVERS}" 371 fi 372 373 export VAL 374} 375