scripts/oe-git-proxy-socks-command: Add fallback to use nc

If our own proxy command isn't available for some reason and nc is available,
fall back to use it.

(From OE-Core rev: aaab6ae94258277dcd2f29823a64689e6245fa7a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2012-03-01 23:53:24 +00:00
parent 64bd33d188
commit 6fd4699d07

View File

@ -8,10 +8,16 @@ if [ -z "$PROXYSOCKS" -a -e "$SCRIPTDIR/oe-git-proxy-socks.c" ]; then
fi fi
PROXYSOCKS=`which oe-git-proxy-socks 2> /dev/null` PROXYSOCKS=`which oe-git-proxy-socks 2> /dev/null`
if [ ! -x "$PROXYSOCKS" ]; then if [ ! -x "$PROXYSOCKS" ]; then
# If that fails, we can see if netcat (nc) is available
NETCAT=`which nc 2> /dev/null`
if [ ! -x "$NETCAT" ]; then
# If that fails, explain to the user # If that fails, explain to the user
echo "Unable to find oe-git-proxy-socks. This is usually created with the command" echo "Unable to find oe-git-proxy-socks. This is usually created with the command"
echo "'gcc scripts/oe-git-proxy-socks.c -o scripts/oe-git-proxy-socks' which we tried" echo "'gcc scripts/oe-git-proxy-socks.c -o scripts/oe-git-proxy-socks' which we tried"
echo "but it doesn't seem to have worked. Please compile the binary manually." echo "but it doesn't seem to have worked. Please compile the binary manually."
echo "Alternativly, install nc (netcat) on this machine."
exit 1 exit 1
fi fi
exec $NETCAT -x $GIT_PROXY_HOST:$GIT_PROXY_PORT "$@"
fi
oe-git-proxy-socks -S $GIT_PROXY_HOST:$GIT_PROXY_PORT $@ oe-git-proxy-socks -S $GIT_PROXY_HOST:$GIT_PROXY_PORT $@