config/global/download.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Jan 06 22:34:36 2009 +0000 (2009-01-06)
changeset 1131 b62d14d45fc4
parent 1022 7b3e8b8d392e
child 1292 546d2ed3410b
child 1366 5e5d1e6f55d3
permissions -rw-r--r--
Add an option to forbid downloads.
Idea and code-base from Don Elwell <don@manifoldlabs.com>, adapted by me.

/trunk/scripts/functions | 6 6 0 0 ++++++
/trunk/config/global/download.in | 18 18 0 0 ++++++++++++++++++
2 files changed, 24 insertions(+)
     1 # Options specific to downloading packages
     2 
     3 comment "Downloading"
     4 
     5 config FORBID_DOWNLOAD
     6     bool
     7     prompt "Forbid downloads"
     8     default n
     9     help
    10       Normally, crosstool-NG will try to download missing tarballs (or
    11       checkout from CVS/SVN...).
    12       If you do not have network connectivity when you run crosstool-NG,
    13       and some files are missing, it can be a long time before crosstool-NG
    14       fails.
    15       
    16       Saying 'y' here will prevent crosstool-NG from downloading missing
    17       files, thus failing early so that you don't get stuck.
    18 
    19 if ! FORBID_DOWNLOAD
    20 
    21 config FORCE_DOWNLOAD
    22     bool
    23     prompt "Force downloads"
    24     default n
    25     help
    26       Force downloading tarballs, even if one already exists.
    27       
    28       Usefull if you suspect a tarball to be damaged.
    29 
    30 menuconfig USE_PROXY
    31     bool
    32     prompt "Use a proxy"
    33     default n
    34     help
    35       Say 'Y' here if you need to use a proxy to connect to the internet.
    36       
    37       You can then choose between an HTTP or a SOCKS 4/5 proxy.
    38       
    39       **** NOTE ****
    40       The settings below may not cover all possible proxy configurations!
    41       You'd be better off setting proxy in the environment!
    42 
    43 if USE_PROXY
    44 
    45 choice
    46     bool
    47     prompt "Proxy type"
    48 
    49 config PROXY_TYPE_HTTP
    50     bool
    51     prompt "HTTP proxy"
    52     help
    53       Use an HTTP proxy to connect to to the internet.
    54       Only the http and ftp protocols will be tunneled through this
    55       proxy.
    56       
    57       Alternatively to setting this option, you can set and export the
    58       following variables in your environment:
    59         ftp_proxy=http://user:passwd@proxy.server:port/
    60         http_proxy=http://user:passwd@proxy.server:port/
    61         https_proxy=http://user:passwd@proxy.server:port/
    62 
    63 # Haha! Here is an interesting feature/bug of mconf!
    64 # The following config entries will be shown out-side the
    65 # choice menu!
    66 # To add a third entry in the choice menu, add it after the
    67 # if...endif conditional below, and so on for a fourth entry...
    68 if PROXY_TYPE_HTTP
    69 
    70 config PROXY_HOST
    71     string
    72     prompt "hostname/IP"
    73 
    74 config PROXY_PORT
    75     int
    76     prompt "port"
    77     default 8080
    78     
    79 config PROXY_USER
    80     string
    81     prompt "user name"
    82 
    83 config PROXY_PASS
    84     string
    85     prompt "password"
    86 
    87 endif # USE_HTTP_PROXY
    88 
    89 config PROXY_TYPE_SOCKS
    90     bool
    91     prompt "SOCKS 4/5 proxy"
    92     help
    93       Use a Socks 4/5 proxy to connect to the internet.
    94       All protocols can get tunneled through this kind of proxy (your
    95       proxy configuration may not allow all protocols, but chances are
    96       that protocols needed by crosstool-NG are allowed).
    97       
    98       Alternatively to setting this option, you can configure tsocks
    99       system-wide, and set and export the following variable in your
   100       environment:
   101         LD_PRELOAD=/path/to/your/tsocks-library.so
   102       
   103       This option makes use of the tsocks library. You will have to have tsocks
   104       installed on your system, of course.
   105       
   106       If you think you do not know what tsocks is, or how to configure it,
   107       chances are that you do not need to set this option.
   108 
   109 if PROXY_TYPE_SOCKS
   110 
   111 choice
   112     bool
   113     prompt "type"
   114     default PROXY_TYPE_SOCKS_SYS
   115 
   116 config PROXY_TYPE_SOCKS_SYS
   117     bool
   118     prompt "Use system settings"
   119     help
   120       Use that if tsocks is already configured on your system.
   121 
   122 config PROXY_TYPE_SOCKS_AUTO
   123     bool
   124     prompt "Auto"
   125     help
   126       crosstool-NG will attempt to guess what type of SOCKS version
   127       the proxy speaks.
   128 
   129 config PROXY_TYPE_SOCKS_4
   130     bool
   131     prompt "SOCKS 4"
   132 
   133 config PROXY_TYPE_SOCKS_5
   134     bool
   135     prompt "SOCKS 5"
   136 
   137 endchoice
   138 
   139 if ! PROXY_TYPE_SOCKS_SYS
   140 
   141 config PROXY_HOST
   142     string
   143     prompt "hostname/IP"
   144 
   145 config PROXY_PORT
   146     int
   147     prompt "port"
   148     default 1080
   149 
   150 config PROXY_USER
   151     string
   152     prompt "user name"
   153 
   154 config PROXY_PASS
   155     string
   156     prompt "password"
   157 
   158 endif # ! PROXY_TYPE_SOCKS_SYS
   159 
   160 endif # USE_SOCKS_PROXY
   161 
   162 endchoice
   163 
   164 endif # USE_PROXY
   165 
   166 config PROXY_TYPE
   167     string
   168     default "none"      if ! USE_PROXY
   169     default "http"      if PROXY_TYPE_HTTP
   170     default "sockssys"  if PROXY_TYPE_SOCKS_SYS
   171     default "socksauto" if PROXY_TYPE_SOCKS_AUTO
   172     default "socks4"    if PROXY_TYPE_SOCKS_4
   173     default "socks5"    if PROXY_TYPE_SOCKS_5
   174 
   175 menuconfig USE_MIRROR
   176     bool
   177     prompt "Use LAN mirror"
   178     default n
   179     help
   180       If you have a machine on your LAN that mirrors some of the needed
   181       tarballs, you can say 'Y' here, and configure adequate values in
   182       the following options.
   183       
   184       Tarballs will be be preferably fetched from the LAN mirror, and if
   185       not found there, standard places will be searched for.
   186       
   187       Obviously, nothing prevents you from using a mirror that is in fact
   188       *not* on your LAN, for example on another subnet of your company's
   189       network, or a mirror on the Internet.
   190       
   191       I (Yann E. MORIN) have set up such a mirror to host snapshots of
   192       some components, when those snapshots are volatile on the upstream
   193       servers. The mirror is *slow*, because it is hosted behind an ADSL
   194       line. For the time being, I haven't set up bandwidth limitations,
   195       but should the mirror be abused, I will. Please avoid using my
   196       machine when you can...
   197       The mirror is available as (fill in those values in the fields
   198       below):
   199         host name: ymorin.is-a-geek.org
   200         base dir : /mirrors
   201 
   202 if USE_MIRROR
   203 
   204 config PREFER_MIRROR
   205     bool
   206     prompt "Prefer the LAN mirror"
   207     default n
   208     help
   209       Say 'Y' here if you prefer the LAN miror over the upstream sources.
   210 
   211 choice
   212     bool
   213     prompt "Server type:"
   214 
   215 config MIRROR_HTTP
   216     bool
   217     prompt "http"
   218 
   219 config MIRROR_FTP
   220     bool
   221     prompt "ftp"
   222 
   223 endchoice # Server type
   224 
   225 config MIRROR_SCHEME
   226     string
   227     default "http"  if MIRROR_HTTP
   228     default "ftp"   if MIRROR_FTP
   229 
   230 config MIRROR_HOSTNAME
   231     string
   232     prompt "hostname"
   233     default ""
   234     help
   235       Enter here the hostname on your LAN mirror.
   236 
   237 config MIRROR_BASE
   238     string
   239     prompt "Base directory"
   240     default ""
   241     help
   242       This is the base directory searched for for tarballs. If you enter
   243       /mirror, then the search is performed in the following directories
   244       on the server:
   245         /mirror/<name>/
   246         /mirror/
   247       
   248       where <name> is replaced with the actual package name.
   249 
   250 config MIRROR_LS_R
   251     bool
   252 #    prompt "Use ls-lR et al."
   253     depends on EXPERIMENTAL
   254     default n
   255     help
   256       If the tarball was not found at the above location, see if the server
   257       has a ls-lr.gz (or similar) file, and use that file to see if the
   258       tarball is listed somewhere in that file.
   259       
   260       Common file names looked for are:
   261         ls-lrRt.txt     (used at ftp.gnu.org)
   262         find.txt        (ditto)
   263         ls-lR
   264 
   265 endif # USE_MIRROR
   266 
   267 config CONNECT_TIMEOUT
   268     int
   269     prompt "connection timeout"
   270     default 10
   271     help
   272       From the curl manual:
   273         Maximum time in seconds that you allow the connection to the server to take.
   274       
   275       The scenario is as follows;
   276         - some enterprise networks have firewalls that prohibit FTP traffic, while
   277           still allowing HTTP
   278         - most download sites have http:// equivalent for the ftp:// URL
   279         - after this number of seconds, it is considered that the connection could
   280           not be established, and the next URL in the list is tried, until we reach
   281           an URL that will go through the firewall, most probably an http:// URL.
   282       
   283       If you have a slow network, you'd better set this value higher than the default
   284       10s. If you know a firewall is blocking connections, but your network is globally
   285       fast, you can try to lower this value to jump more quickly to allowed URLs. YMMV.
   286       
   287       Note that this value applies equally to wget if you have that installed.
   288       
   289       Of course, you'd be better off to use a proxy, as offered by the previous
   290       option.
   291 
   292 config ONLY_DOWNLOAD
   293     bool
   294     prompt "Stop after downloading tarballs"
   295     default n
   296     help
   297       Only download the tarballs. Exit once it done.
   298       
   299       Usefull to pre-retrieve the tarballs before going off-line.
   300 
   301 endif # ! FORBID_DOWNLOAD