Update dediprog fetcher script

Fix a couple of issues, including one that was preventing em100 from
being built:

1) Update dediprog URL, as the old one is dead.

2) Add "rar" dependency, because 7z can't handle the rar files
provided by dediprog.

3) Enable "set -xeu" so it's more obvious what's wrong when something
fails.  This also lets the build abort before an incomplete
em100pro_chips.h gets written to disk, so the next build will retry
makechips.sh instead of proceeding with a totally broken header file.

BUG=chromium:213898
TEST=builds outside of the chroot (Ubuntu Trusty)

Change-Id: I523c5c763ba975d1a3f596d2fbfa828cd2d4fa29
Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
diff --git a/makechips.sh b/makechips.sh
index 753bd59..7fe8872 100755
--- a/makechips.sh
+++ b/makechips.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -xeu
 #
 # Copyright (C) 2012 The Chromium OS Authors.
 #
@@ -16,31 +16,38 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 #
 
-URL=http://www.dediprog.com/files/81/2867/4/EM100_4.2.07.zip
-
-if ! which curl > /dev/null; then
-  echo "Install curl to run this script."
-  exit 1;
-fi
-if ! which 7z > /dev/null; then
-  echo "Install 7z to run this script."
-  exit 1
-fi
-if ! which cabextract > /dev/null; then
-  echo "Install cabextract to run this script."
-  exit 1
-fi
+URL=http://www.dediprog.com/save/78.rar/to/EM100Pro_4.2.24.rar
 
 FILE=$(basename $URL)
 TEMP=$(mktemp -d)
 WD=$(pwd)
 
+function run_unrar()
+{
+	if which rar >& /dev/null; then
+		rar x "$@"
+		return $?
+	elif which unrar >& /dev/null; then
+		unrar x "$@"
+		return $?
+	# unrar-free is not currently able to handle this file, but maybe
+	# a future update will fix it
+	#elif which unrar-free >& /dev/null; then
+	#	unrar-free "$@"
+	#	return $?
+	else
+		echo "No RAR unpacker found, aborting"
+		echo "Try installing rar or unrar."
+		return 1
+	fi
+}
+
 cd $TEMP
 echo Downloading...
 curl -s $URL -o $FILE || exit
 echo Unpacking...
-7z x $FILE ${FILE%.zip}.msi > /dev/null
-7z x ${FILE%.zip}.msi PRO_* > /dev/null
+run_unrar $FILE ${FILE%.rar}.msi > /dev/null
+7z x ${FILE%.rar}.msi PRO_* > /dev/null
 echo  Copying...
 mkdir -p $WD/configs
 for i in PRO_*; do