config/global/download_extract.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Apr 26 21:31:05 2008 +0000 (2008-04-26)
changeset 454 372b2f397baa
parent 451 8a72f9bcf675
child 487 ef82cb824406
permissions -rw-r--r--
Configure tsocks with a simple heuristic.

Consider the proxy has to be in a 'local' network. It means it is directly
reachable by the local machine, even if the local machine has to hop through
one or more gates to reach the proxy (often the case in enterprise networks
where class A 10.0.0.0/8 is in fact sub-divided into smaller networks, each
one of them in a different location, eg. 10.1.0.0/16 in a place, while
10.2.0.0/16 would be on the other side of the world). Not being in the same
subnet does not mean the proxy is not available.

So we will build a mask with at most high bits set, which defines a network
that has both the local machine and the proxy. Because a machine may have
more than one interface, build a mask for each of them, removing 127.0.0.1
which is added automagically by tsocks, and removing duplicate masks.

If all of this does not work, then it means the local machine can NOT in fact
reach the proxy, which in turn means the user mis-configured something (most
probably a typo...).

/trunk/scripts/crosstool.sh | 61 52 9 0 +++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 52 insertions(+), 9 deletions(-)
yann@445
     1
# Options specific to downloading and extracting packages
yann@174
     2
yann@63
     3
comment "Downloading"
yann@1
     4
yann@63
     5
config FORCE_DOWNLOAD
yann@1
     6
    bool
yann@63
     7
    prompt "Force downloads"
yann@1
     8
    default n
yann@1
     9
    help
yann@63
    10
      Force downloading tarballs, even if one already exists.
yann@63
    11
      
yann@63
    12
      Usefull if you suspect a tarball to be damaged.
yann@1
    13
yann@1
    14
config ONLY_DOWNLOAD
yann@1
    15
    bool
yann@63
    16
    prompt "Stop after downloading tarballs"
yann@1
    17
    default n
yann@1
    18
    help
yann@1
    19
      Only download the tarballs. Exit once it done.
yann@1
    20
      
yann@1
    21
      Usefull to pre-retrieve the tarballs before going off-line.
yann@1
    22
yann@441
    23
choice
yann@441
    24
    bool
yann@441
    25
    prompt "Proxy type"
yann@441
    26
    default USE_NO_PROXY
yann@441
    27
yann@442
    28
config PROXY_TYPE_NONE
yann@441
    29
    bool
yann@441
    30
    prompt "No proxy"
yann@441
    31
    help
yann@441
    32
      Select this option if you have a direct connection to the internet,
yann@441
    33
      or if you already set the environment adequately.
yann@441
    34
yann@442
    35
config PROXY_TYPE_HTTP
yann@441
    36
    bool
yann@441
    37
    prompt "HTTP proxy"
yann@441
    38
    help
yann@441
    39
      Use an HTTP proxy to connect to to the internet.
yann@442
    40
      Only the http and ftp protocols will be tunneled through this
yann@441
    41
      proxy.
yann@441
    42
yann@442
    43
      Alternatively to setting this option, you can set and export the
yann@442
    44
      following variables in your environment:
yann@441
    45
        ftp_proxy=http://user:passwd@proxy.server:port/
yann@441
    46
        http_proxy=http://user:passwd@proxy.server:port/
yann@441
    47
        https_proxy=http://user:passwd@proxy.server:port/
yann@441
    48
yann@441
    49
# Haha! Here is an interesting feature/bug of mconf!
yann@441
    50
# The following config entries will be shown out-side the
yann@441
    51
# choice menu!
yann@441
    52
# To add a third entry in the choice menu, add it after the
yann@441
    53
# if...endif conditional below, and so on for a fourth entry...
yann@442
    54
if PROXY_TYPE_HTTP
yann@441
    55
yann@442
    56
config PROXY_HOST
yann@441
    57
    string
yann@442
    58
    prompt "hostname/IP"
yann@441
    59
yann@442
    60
config PROXY_PORT
yann@441
    61
    int
yann@442
    62
    prompt "port"
yann@452
    63
    default 8080
yann@441
    64
    
yann@442
    65
config PROXY_USER
yann@441
    66
    string
yann@442
    67
    prompt "user name"
yann@441
    68
yann@442
    69
config PROXY_PASS
yann@441
    70
    string
yann@442
    71
    prompt "password"
yann@441
    72
yann@441
    73
endif # USE_HTTP_PROXY
yann@441
    74
yann@442
    75
config PROXY_TYPE_SOCKS
yann@442
    76
    bool
yann@451
    77
    prompt "SOCKS 4/5 proxy (EXPERIMENTAL)"
yann@451
    78
    depends on EXPERIMENTAL
yann@442
    79
    help
yann@442
    80
      Use a Socks 4/5 proxy to connect to the internet.
yann@442
    81
      All protocols can get tunneled through this kind of proxy (depending
yann@442
    82
      on your proxy configuration, so;e do not allow all protocols, but
yann@442
    83
      chances are that protocols needed by crosstool-NG are allowed).
yann@442
    84
yann@452
    85
      Please note that the proxy you are using MUST be on the same subnet
yann@452
    86
      as your machine. That is, it must be reachable without a hop through
yann@452
    87
      any gate. If this is not the case, then do NOT use this option, and
yann@452
    88
      setup tsocks system-wide.
yann@452
    89
yann@452
    90
      Alternatively to setting this option, you can configure tsocks
yann@452
    91
      system-wide, and set and export the following variable in your
yann@452
    92
      environment:
yann@442
    93
        LD_PRELOAD=/path/to/your/tsocks-library.so
yann@442
    94
yann@442
    95
      This option makes use of the tsocks library. You will have to have tsocks
yann@442
    96
      installed on your system, of course.
yann@442
    97
yann@442
    98
      If you think you do not know what tsocks is, or how to configure it,
yann@442
    99
      chances are that you do not need to set this option.
yann@442
   100
yann@442
   101
if PROXY_TYPE_SOCKS
yann@442
   102
yann@442
   103
choice
yann@442
   104
    bool
yann@442
   105
    prompt "type"
yann@451
   106
    default PROXY_TYPE_SOCKS_SYS
yann@451
   107
yann@451
   108
config PROXY_TYPE_SOCKS_SYS
yann@451
   109
    bool
yann@451
   110
    prompt "Use system settings"
yann@451
   111
    help
yann@452
   112
      Use that if tsocks is already configured on your system.
yann@451
   113
yann@451
   114
config PROXY_TYPE_SOCKS_AUTO
yann@451
   115
    bool
yann@452
   116
    prompt "Auto (BROKEN)"
yann@452
   117
    depends on BROKEN
yann@451
   118
    help
yann@452
   119
      crosstool-NG will attempt to guess what type of SOCKS version
yann@452
   120
      the proxy speaks.
yann@451
   121
yann@451
   122
config PROXY_TYPE_SOCKS_4
yann@451
   123
    bool
yann@452
   124
    prompt "SOCKS 4 (BROKEN)"
yann@452
   125
    depends on BROKEN
yann@442
   126
yann@442
   127
config PROXY_TYPE_SOCKS_5
yann@442
   128
    bool
yann@452
   129
    prompt "SOCKS 5 (BROKEN)"
yann@452
   130
    depends on BROKEN
yann@442
   131
yann@451
   132
endchoice
yann@442
   133
yann@451
   134
if ! PROXY_TYPE_SOCKS_SYS
yann@451
   135
yann@442
   136
config PROXY_HOST
yann@442
   137
    string
yann@442
   138
    prompt "hostname/IP"
yann@442
   139
yann@442
   140
config PROXY_PORT
yann@442
   141
    int
yann@442
   142
    prompt "port"
yann@452
   143
    default 1080
yann@442
   144
yann@442
   145
config PROXY_USER
yann@442
   146
    string
yann@442
   147
    prompt "user name"
yann@442
   148
yann@442
   149
config PROXY_PASS
yann@442
   150
    string
yann@442
   151
    prompt "password"
yann@442
   152
yann@451
   153
endif # ! PROXY_TYPE_SOCKS_SYS
yann@451
   154
yann@442
   155
endif # USE_SOCKS_PROXY
yann@442
   156
yann@442
   157
endchoice
yann@442
   158
yann@442
   159
config PROXY_TYPE
yann@442
   160
    string
yann@451
   161
    default "none"      if PROXY_TYPE_NONE
yann@451
   162
    default "http"      if PROXY_TYPE_HTTP
yann@451
   163
    default "sockssys"  if PROXY_TYPE_SOCKS_SYS
yann@451
   164
    default "socksauto" if PROXY_TYPE_SOCKS_AUTO
yann@451
   165
    default "socks4"    if PROXY_TYPE_SOCKS_4
yann@451
   166
    default "socks5"    if PROXY_TYPE_SOCKS_5
yann@442
   167
yann@441
   168
# Force restore indentation
yann@445
   169
config BREAK_INDENT
yann@445
   170
    bool
yann@445
   171
    default n
yann@121
   172
yann@244
   173
if ! ONLY_DOWNLOAD
yann@244
   174
yann@63
   175
comment "Extracting"
yann@1
   176
yann@1
   177
config FORCE_EXTRACT
yann@1
   178
    bool
yann@1
   179
    prompt "Force extractions"
yann@1
   180
    default n
yann@1
   181
    help
yann@1
   182
      Force extraction of already exctracted tarballs.
yann@1
   183
      
yann@1
   184
      Usefull if you suspect a previous extract did not complete (eg. broken
yann@1
   185
      tarball), or you added a new set of patches for this component.
yann@1
   186
yann@63
   187
config ONLY_EXTRACT
yann@63
   188
    bool
yann@63
   189
    prompt "Stop after extracting tarballs"
yann@63
   190
    default n
yann@63
   191
    help
yann@63
   192
      Exit after unpacking and patching tarballs.
yann@63
   193
      
yann@63
   194
      Usefull to look at the code before doing the build itself.
yann@63
   195
yann@244
   196
endif # ! ONLY_DOWNLOAD