scripts/showSamples.sh
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 168 45811aef4097
child 474 2904d77fe117
permissions -rwxr-xr-x
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@74
     1
#!/bin/bash
yann@74
     2
yann@74
     3
# Parses all samples on the command line, and for each of them, prints
yann@74
     4
# the versions of the main tools
yann@74
     5
yann@74
     6
# GREP_OPTIONS screws things up.
yann@74
     7
export GREP_OPTIONS=
yann@74
     8
yann@74
     9
# Dump a single sample
yann@74
    10
dump_single_sample() {
yann@74
    11
    local width="$1"
yann@74
    12
    local sample="$2"
yann@182
    13
    if [ -f "${CT_TOP_DIR}/samples/${sample}/crosstool.config" ]; then
yann@182
    14
        sample_top="${CT_TOP_DIR}"
yann@182
    15
        sample_type="local"
yann@182
    16
    else
yann@182
    17
        sample_top="${CT_LIB_DIR}"
yann@182
    18
        sample_type="global"
yann@182
    19
    fi
yann@182
    20
    printf "  %-*s  (%s" ${width} "${sample}" "${sample_type}"
yann@182
    21
    [ -f "${sample_top}/samples/${sample}/broken" ] && printf ",broken"
yann@182
    22
    echo ")"
yann@74
    23
}
yann@74
    24
yann@74
    25
# Get largest sample width
yann@74
    26
width=0
yann@74
    27
for sample in "${@}"; do
yann@74
    28
    [ ${#sample} -gt ${width} ] && width=${#sample}
yann@74
    29
done
yann@74
    30
yann@74
    31
for sample in "${@}"; do
yann@74
    32
    ( dump_single_sample ${width} "${sample}" )
yann@74
    33
done