mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-22 06:07:49 +00:00
Add an option to use a SOCKS 4/5 proxy to connect to the internet.
As for the HTTP proxy, this is completetly untested, as I have no such proxy at home. scripts/crosstool.sh | 45 31 14 0 +++++++++++++++++-------- config/global.in | 95 81 14 0 +++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 112 insertions(+), 28 deletions(-)
This commit is contained in:
parent
0b89b1a938
commit
9e9d061e01
@ -251,23 +251,23 @@ choice
|
|||||||
prompt "Proxy type"
|
prompt "Proxy type"
|
||||||
default USE_NO_PROXY
|
default USE_NO_PROXY
|
||||||
|
|
||||||
config USE_NO_PROXY
|
config PROXY_TYPE_NONE
|
||||||
bool
|
bool
|
||||||
prompt "No proxy"
|
prompt "No proxy"
|
||||||
help
|
help
|
||||||
Select this option if you have a direct connection to the internet,
|
Select this option if you have a direct connection to the internet,
|
||||||
or if you already set the environment adequately.
|
or if you already set the environment adequately.
|
||||||
|
|
||||||
config USE_HTTP_PROXY
|
config PROXY_TYPE_HTTP
|
||||||
bool
|
bool
|
||||||
prompt "HTTP proxy"
|
prompt "HTTP proxy"
|
||||||
help
|
help
|
||||||
Use an HTTP proxy to connect to to the internet.
|
Use an HTTP proxy to connect to to the internet.
|
||||||
Onlt the http and ftp protocols will be tunneled through this
|
Only the http and ftp protocols will be tunneled through this
|
||||||
proxy.
|
proxy.
|
||||||
|
|
||||||
Alternatively to setting this options, you can set and export
|
Alternatively to setting this option, you can set and export the
|
||||||
the following variable in your environment:
|
following variables in your environment:
|
||||||
ftp_proxy=http://user:passwd@proxy.server:port/
|
ftp_proxy=http://user:passwd@proxy.server:port/
|
||||||
http_proxy=http://user:passwd@proxy.server:port/
|
http_proxy=http://user:passwd@proxy.server:port/
|
||||||
https_proxy=http://user:passwd@proxy.server:port/
|
https_proxy=http://user:passwd@proxy.server:port/
|
||||||
@ -277,28 +277,95 @@ config USE_HTTP_PROXY
|
|||||||
# choice menu!
|
# choice menu!
|
||||||
# To add a third entry in the choice menu, add it after the
|
# To add a third entry in the choice menu, add it after the
|
||||||
# if...endif conditional below, and so on for a fourth entry...
|
# if...endif conditional below, and so on for a fourth entry...
|
||||||
if USE_HTTP_PROXY
|
if PROXY_TYPE_HTTP
|
||||||
|
|
||||||
config HTTP_PROXY_HOST
|
config PROXY_HOST
|
||||||
string
|
string
|
||||||
prompt "HTTP proxy hostname/IP"
|
prompt "hostname/IP"
|
||||||
|
|
||||||
config HTTP_PROXY_PORT
|
config PROXY_PORT
|
||||||
int
|
int
|
||||||
prompt "HTTP proxy port"
|
prompt "port"
|
||||||
|
default 0
|
||||||
|
|
||||||
config HTTP_PROXY_USER
|
config PROXY_USER
|
||||||
string
|
string
|
||||||
prompt "HTTP proxy user name"
|
prompt "user name"
|
||||||
|
|
||||||
config HTTP_PROXY_PASSWD
|
config PROXY_PASS
|
||||||
string
|
string
|
||||||
prompt "HTTP proxy password"
|
prompt "password"
|
||||||
|
|
||||||
endif # USE_HTTP_PROXY
|
endif # USE_HTTP_PROXY
|
||||||
|
|
||||||
|
config PROXY_TYPE_SOCKS
|
||||||
|
bool
|
||||||
|
prompt "SOCKS 4/5 proxy"
|
||||||
|
help
|
||||||
|
Use a Socks 4/5 proxy to connect to the internet.
|
||||||
|
All protocols can get tunneled through this kind of proxy (depending
|
||||||
|
on your proxy configuration, so;e do not allow all protocols, but
|
||||||
|
chances are that protocols needed by crosstool-NG are allowed).
|
||||||
|
|
||||||
|
Alternatively to setting this option, you can set and export the
|
||||||
|
following variable in your environment:
|
||||||
|
LD_PRELOAD=/path/to/your/tsocks-library.so
|
||||||
|
|
||||||
|
In any case, wether you set this option or you export the aforementionned
|
||||||
|
variable, you will _have_ to configure the /etc/tsocks.conf file
|
||||||
|
accordingly to your network setup.
|
||||||
|
|
||||||
|
This option makes use of the tsocks library. You will have to have tsocks
|
||||||
|
installed on your system, of course.
|
||||||
|
|
||||||
|
If you think you do not know what tsocks is, or how to configure it,
|
||||||
|
chances are that you do not need to set this option.
|
||||||
|
|
||||||
|
if PROXY_TYPE_SOCKS
|
||||||
|
|
||||||
|
choice
|
||||||
|
bool
|
||||||
|
prompt "type"
|
||||||
|
default PROXY_TYPE_SOCKS_5
|
||||||
|
|
||||||
|
config PROXY_TYPE_SOCKS_5
|
||||||
|
bool
|
||||||
|
prompt "SOCKS 5"
|
||||||
|
|
||||||
|
config PROXY_TYPE_SOCKS_4
|
||||||
|
bool
|
||||||
|
prompt "SOCKS 4"
|
||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
|
config PROXY_HOST
|
||||||
|
string
|
||||||
|
prompt "hostname/IP"
|
||||||
|
|
||||||
|
config PROXY_PORT
|
||||||
|
int
|
||||||
|
prompt "port"
|
||||||
|
default 0
|
||||||
|
|
||||||
|
config PROXY_USER
|
||||||
|
string
|
||||||
|
prompt "user name"
|
||||||
|
|
||||||
|
config PROXY_PASS
|
||||||
|
string
|
||||||
|
prompt "password"
|
||||||
|
|
||||||
|
endif # USE_SOCKS_PROXY
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
config PROXY_TYPE
|
||||||
|
string
|
||||||
|
default "none" if PROXY_TYPE_NONE
|
||||||
|
default "HTTP" if PROXY_TYPE_HTTP
|
||||||
|
default "socks5" if PROXY_TYPE_SOCKS_5
|
||||||
|
default "socks4" if PROXY_TYPE_SOCKS_4
|
||||||
|
|
||||||
# Force restore indentation
|
# Force restore indentation
|
||||||
config FOOBAR
|
config FOOBAR
|
||||||
|
|
||||||
|
@ -206,6 +206,37 @@ case "${CT_LOG_TO_FILE}" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Set environment for proxy access
|
||||||
|
# This has to be done even if we are restarting, as they don't get
|
||||||
|
# saved in the step snapshot.
|
||||||
|
case "${CT_PROXY_TYPE}" in
|
||||||
|
none) ;;
|
||||||
|
http)
|
||||||
|
http_proxy="http://"
|
||||||
|
case "${CT_PROXY_USER}:${CT_PROXY_PASS}" in
|
||||||
|
:) ;;
|
||||||
|
:*) http_proxy="${http_proxy}:${CT_HTP_PROXY_PASS}@";;
|
||||||
|
*:) http_proxy="${http_proxy}${CT_HTTP_PROXY_USER}@";;
|
||||||
|
*:*) http_proxy="${http_proxy}${CT_HTTP_PROXY_USER}:${CT_HTP_PROXY_PASS}@";;
|
||||||
|
esac
|
||||||
|
export http_proxy="${http_proxy}${HTTP_PROXY_HOST}:${HTTP_PROXY_PORT}/"
|
||||||
|
export https_proxy="${http_proxy}"
|
||||||
|
export ftp_proxy="${http_proxy}"
|
||||||
|
;;
|
||||||
|
socks?)
|
||||||
|
# Re;ove any lingering config file from any previous run
|
||||||
|
rm -f "${CT_BUILD_DIR}/tsocks.conf"
|
||||||
|
( echo "server=${CT_PROXY_HOST}";
|
||||||
|
echo "server_port=${CT_PROXY_PORT}";
|
||||||
|
echo "server_type=${CT_PROXY_TYPE#socks}";
|
||||||
|
[ -n "${CT_PROXY_USER}" ] && echo "default_user=${CT_PROXY_USER}";
|
||||||
|
[ -n "${CT_PROXY_PASS}" ] && echo "default_pass=${CT_PROXY_PASS}";
|
||||||
|
) >"${CT_BUILD_DIR}/tsocks.conf"
|
||||||
|
export TSOCKS_CONF_FILE="${CT_BUILD_DIR}/tsocks.conf"
|
||||||
|
. tsocks -on
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Setting up the rest of the environment only if not restarting
|
# Setting up the rest of the environment only if not restarting
|
||||||
if [ -z "${CT_RESTART}" ]; then
|
if [ -z "${CT_RESTART}" ]; then
|
||||||
# Determine build system if not set by the user
|
# Determine build system if not set by the user
|
||||||
@ -307,20 +338,6 @@ if [ -z "${CT_RESTART}" ]; then
|
|||||||
[ ${CT_PARALLEL_JOBS} -ne 0 ] && PARALLELMFLAGS="${PARALLELMFLAGS} -j${CT_PARALLEL_JOBS}"
|
[ ${CT_PARALLEL_JOBS} -ne 0 ] && PARALLELMFLAGS="${PARALLELMFLAGS} -j${CT_PARALLEL_JOBS}"
|
||||||
[ ${CT_LOAD} -ne 0 ] && PARALLELMFLAGS="${PARALLELMFLAGS} -l${CT_LOAD}"
|
[ ${CT_LOAD} -ne 0 ] && PARALLELMFLAGS="${PARALLELMFLAGS} -l${CT_LOAD}"
|
||||||
|
|
||||||
# Set environment for proxy access
|
|
||||||
if [ "${CT_USE_HTTP_PROXY}" = "y" ]; then
|
|
||||||
http_proxy="http://"
|
|
||||||
case "${CT_HTTP_PROXY_USER}:${CT_HTTP_PROXY_PASSWD}" in
|
|
||||||
:) ;;
|
|
||||||
:*) http_proxy="${http_proxy}:${CT_HTP_PROXY_PASSWD}@";;
|
|
||||||
*:) http_proxy="${http_proxy}${CT_HTTP_PROXY_USER}@";;
|
|
||||||
*:*) http_proxy="${http_proxy}${CT_HTTP_PROXY_USER}:${CT_HTP_PROXY_PASSWD}@";;
|
|
||||||
esac
|
|
||||||
export http_proxy="${http_proxy}${HTTP_PROXY_HOST}:${HTTP_PROXY_PORT}/"
|
|
||||||
export https_proxy="${http_proxy}"
|
|
||||||
export ftp_proxy="${http_proxy}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
CT_DoStep EXTRA "Dumping internal crosstool-NG configuration"
|
CT_DoStep EXTRA "Dumping internal crosstool-NG configuration"
|
||||||
CT_DoLog EXTRA "Building a toolchain for:"
|
CT_DoLog EXTRA "Building a toolchain for:"
|
||||||
CT_DoLog EXTRA " build = ${CT_BUILD}"
|
CT_DoLog EXTRA " build = ${CT_BUILD}"
|
||||||
|
Loading…
Reference in New Issue
Block a user