Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[b1f6a9]: x86-mingw32-build.sh.mirrors Maximize Restore History

Download this file

x86-mingw32-build.sh.mirrors    74 lines (66 with data), 2.6 kB

# x86-mingw32-build.sh.mirrors -*- sh -*- vim: filetype=sh
# $Id$
#
# Identify a SourceForge Mirror Site, from which to download packages.
#
# Copyright (C) 2006, 2009, 2010, MinGW Project
# Written by Keith Marshall <keithmarshall@users.sourceforge.net>
#
# This file is a component of the x86-mingw32-build script; it is not
# intended for stand alone use.
# 
# x86-mingw32-build is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
# 
# x86-mingw32-build is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for further details.
# 
# You should have received a copy of the GNU General Public License along
# with x86-mingw32-build; see the file COPYING.  If not, write to the Free
# Software Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301,
# USA.

AVAILABLE_MIRRORS="none `sed '
  /^#/d;s/^[ 	]\{1,\}//;s/[ 	]\{1,\}/./g
  ' $script.hosts | cut -d. -f1-2`"

display()
# usage: display Index MirrorName.REGION
#
# Defines the tabulation format for display of the mirror names
# in the mirror selection menu.
{
  local indent name region
  test $1 -gt 9 && indent=`space 1` || indent=`space 2`
  region=`IFS=.; set $2; test $2 && echo "($2)"`
  name=`IFS=.; set $2; echo "$1\`space 8\`" | cut -c1-11`
  echo "$indent$1) $name $region `space 4`" | cut -c1-21
}

if test "$BUILD_METHOD" = interactive
then echo "
 Please select one of the following mirrors, from which to download any
 required packages, (or select `quote none` to inhibit downloading):--
"
MAX_MIRROR_INDEX=`set $AVAILABLE_MIRRORS; shift; echo $#`
tabulate 0 3 5 display "$AVAILABLE_MIRRORS"
fi

AVAILABLE_MIRRORS=`for mirror in $AVAILABLE_MIRRORS
do echo \`IFS=.; set x $mirror; echo $2\`; done`
REPLY=`posn REPLY "$DOWNLOAD_OPTIONS" "$AVAILABLE_MIRRORS"`

test "$BUILD_METHOD" = interactive && askindex "
 Enter the index number for your choice:" $REPLY 0 $MAX_MIRROR_INDEX REPLY \:

if test $REPLY -gt 0
then
  REPLY=`set $AVAILABLE_MIRRORS; shift $REPLY; echo $1`
  DOWNLOAD_OPTIONS="?download&use_mirror=$REPLY"
else
  if test "$ALLOW_DOWNLOADS" = YES && test "$BUILD_METHOD" = unattended
  then
    echo "$script.conf: DOWNLOAD_OPTIONS does not specify a valid mirror"
    echo "$script.mirrors: automatic download feature is disabled"
  fi
  ALLOW_DOWNLOADS=NO
fi

# $RCSfile$Revision: 1.5 $: end of file