1.1 --- a/scripts/crosstool.sh Sun Jul 27 16:35:37 2008 +0000
1.2 +++ b/scripts/crosstool.sh Fri Aug 01 09:23:58 2008 +0000
1.3 @@ -101,8 +101,10 @@
1.4 CT_Abort "I will stop here to avoid any carnage"
1.5 fi
1.6
1.7 -# Make all path absolute, it so much easier!
1.8 -CT_LOCAL_TARBALLS_DIR=$(CT_MakeAbsolutePath "${CT_LOCAL_TARBALLS_DIR}")
1.9 +if [ -n "${CT_LOCAL_TARBALLS_DIR}" ]; then
1.10 + # Make absolute path, it so much easier!
1.11 + CT_LOCAL_TARBALLS_DIR=$(CT_MakeAbsolutePath "${CT_LOCAL_TARBALLS_DIR}")
1.12 +fi
1.13
1.14 # If the local tarball directory does not exist, say so, and don't try to save there!
1.15 if [ ! -d "${CT_LOCAL_TARBALLS_DIR}" ]; then
1.16 @@ -211,105 +213,6 @@
1.17 ;;
1.18 esac
1.19
1.20 -# Set environment for proxy access
1.21 -# This has to be done even if we are restarting, as they don't get
1.22 -# saved in the step snapshot.
1.23 -case "${CT_PROXY_TYPE}" in
1.24 - none) ;;
1.25 - http)
1.26 - http_proxy="http://"
1.27 - case "${CT_PROXY_USER}:${CT_PROXY_PASS}" in
1.28 - :) ;;
1.29 - :*) http_proxy="${http_proxy}:${CT_PROXY_PASS}@";;
1.30 - *:) http_proxy="${http_proxy}${CT_PROXY_USER}@";;
1.31 - *:*) http_proxy="${http_proxy}${CT_PROXY_USER}:${CT_PROXY_PASS}@";;
1.32 - esac
1.33 - export http_proxy="${http_proxy}${CT_PROXY_HOST}:${CT_PROXY_PORT}/"
1.34 - export https_proxy="${http_proxy}"
1.35 - export ftp_proxy="${http_proxy}"
1.36 - CT_DoLog DEBUG "http_proxy='${http_proxy}'"
1.37 - ;;
1.38 - sockssys)
1.39 - # Force not using HTTP proxy
1.40 - unset http_proxy ftp_proxy https_proxy
1.41 - CT_HasOrAbort tsocks
1.42 - . tsocks -on
1.43 - ;;
1.44 - socks*)
1.45 - # Force not using HTTP proxy
1.46 - unset http_proxy ftp_proxy https_proxy
1.47 - # Remove any lingering config file from any previous run
1.48 - rm -f "${CT_BUILD_DIR}/tsocks.conf"
1.49 - # Find all interfaces and build locally accessible networks
1.50 - server_ip=$(ping -c 1 -W 2 "${CT_PROXY_HOST}" |head -n 1 |sed -r -e 's/^[^\(]+\(([^\)]+)\).*$/\1/;' || true)
1.51 - CT_TestOrAbort "SOCKS proxy '${CT_PROXY_HOST}' has no IP." -n "${server_ip}"
1.52 - /sbin/ifconfig |awk -v server_ip="${server_ip}" '
1.53 - BEGIN {
1.54 - split( server_ip, tmp, "\\." );
1.55 - server_ip_num = tmp[1] * 2^24 + tmp[2] * 2^16 + tmp[3] * 2^8 + tmp[4] * 2^0;
1.56 - pairs = 0;
1.57 - }
1.58 -
1.59 - $0 ~ /^[[:space:]]*inet addr:/ {
1.60 - split( $2, tmp, ":|\\." );
1.61 - if( ( tmp[2] == 127 ) && ( tmp[3] == 0 ) && ( tmp[4] == 0 ) && ( tmp[5] == 1 ) ) {
1.62 - /* Skip 127.0.0.1, it'\''s taken care of by tsocks itself */
1.63 - next;
1.64 - }
1.65 - ip_num = tmp[2] * 2^24 + tmp[3] * 2^16 + tmp[4] * 2 ^8 + tmp[5] * 2^0;
1.66 - i = 32;
1.67 - do {
1.68 - i--;
1.69 - mask = 2^32 - 2^i;
1.70 - } while( (i!=0) && ( and( server_ip_num, mask ) == and( ip_num, mask ) ) );
1.71 - mask = and( 0xFFFFFFFF, lshift( mask, 1 ) );
1.72 - if( (i!=0) && (mask!=0) ) {
1.73 - masked_ip = and( ip_num, mask );
1.74 - for( i=0; i<pairs; i++ ) {
1.75 - if( ( masked_ip == ips[i] ) && ( mask == masks[i] ) ) {
1.76 - next;
1.77 - }
1.78 - }
1.79 - ips[pairs] = masked_ip;
1.80 - masks[pairs] = mask;
1.81 - pairs++;
1.82 - printf( "local = %d.%d.%d.%d/%d.%d.%d.%d\n",
1.83 - and( 0xFF, masked_ip / 2^24 ),
1.84 - and( 0xFF, masked_ip / 2^16 ),
1.85 - and( 0xFF, masked_ip / 2^8 ),
1.86 - and( 0xFF, masked_ip / 2^0 ),
1.87 - and( 0xFF, mask / 2^24 ),
1.88 - and( 0xFF, mask / 2^16 ),
1.89 - and( 0xFF, mask / 2^8 ),
1.90 - and( 0xFF, mask / 2^0 ) );
1.91 - }
1.92 - }
1.93 - ' >"${CT_BUILD_DIR}/tsocks.conf"
1.94 - ( echo "server = ${server_ip}";
1.95 - echo "server_port = ${CT_PROXY_PORT}";
1.96 - [ -n "${CT_PROXY_USER}" ] && echo "default_user=${CT_PROXY_USER}";
1.97 - [ -n "${CT_PROXY_PASS}" ] && echo "default_pass=${CT_PROXY_PASS}";
1.98 - ) >>"${CT_BUILD_DIR}/tsocks.conf"
1.99 - case "${CT_PROXY_TYPE/socks}" in
1.100 - 4|5) proxy_type="${CT_PROXY_TYPE/socks}";;
1.101 - auto)
1.102 - reply=$(inspectsocks "${server_ip}" "${CT_PROXY_PORT}" 2>&1 || true)
1.103 - case "${reply}" in
1.104 - *"server is a version 4 socks server") proxy_type=4;;
1.105 - *"server is a version 5 socks server") proxy_type=5;;
1.106 - *) CT_Abort "Unable to determine SOCKS proxy type for '${CT_PROXY_HOST}:${CT_PROXY_PORT}'"
1.107 - esac
1.108 - ;;
1.109 - esac
1.110 - echo "server_type = ${proxy_type}" >> "${CT_BUILD_DIR}/tsocks.conf"
1.111 - CT_HasOrAbort tsocks
1.112 - # If tsocks was found, then validateconf is present (distributed with tsocks).
1.113 - CT_DoExecLog DEBUG validateconf -f "${CT_BUILD_DIR}/tsocks.conf"
1.114 - export TSOCKS_CONF_FILE="${CT_BUILD_DIR}/tsocks.conf"
1.115 - . tsocks -on
1.116 - ;;
1.117 -esac
1.118 -
1.119 # Setting up the rest of the environment only if not restarting
1.120 if [ -z "${CT_RESTART}" ]; then
1.121 # Determine build system if not set by the user