Skip to contentSkip to conversation

scripts/oe-git-proxy-socks-command: Improve error fallback/handling

PATCH New Richard Purdie 1 participant 1 message Mar 1, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/oe-git-proxy-socks-command: Improve error fallback/handling

If oe-git-proxy-socks isn't available, try and create it.

If that fails, tell the user there is a problem, don't just fail to find the command.

[YOCTO #2007]

---

scripts/oe-git-proxy-socks-command +15 -0
index 90fa14e..39e0acb 100755
@@ -1,2 +1,17 @@
 #! /bin/bash
+SCRIPTDIR=`dirname $0`
+# Check oe-git-proxy-socks exists
+PROXYSOCKS=`which oe-git-proxy-socks 2> /dev/null`
+if [ -z "$PROXYSOCKS" -a -e "$SCRIPTDIR/oe-git-proxy-socks.c" ]; then
+	# If not try and build it
+	gcc $SCRIPTDIR/oe-git-proxy-socks.c -o $SCRIPTDIR/oe-git-proxy-socks
+fi
+PROXYSOCKS=`which oe-git-proxy-socks 2> /dev/null`
+if [ ! -x "$PROXYSOCKS" ]; then
+	# If that fails, explain to the user
+	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 "but it doesn't seem to have worked. Please compile the binary manually."
+	exit 1
+fi
 oe-git-proxy-socks -S $GIT_PROXY_HOST:$GIT_PROXY_PORT $@