aboutsummaryrefslogtreecommitdiff
path: root/linaro-hwpack-install
diff options
context:
space:
mode:
authorGuilherme Salgado <salgado@canonical.com>2010-10-06 11:54:52 -0300
committerGuilherme Salgado <salgado@canonical.com>2010-10-06 11:54:52 -0300
commitee37026081f25dd459b3bea3cedbe1faee8ea3ba (patch)
treeecad01ac72067de865cf06350b3159b0bbc928e7 /linaro-hwpack-install
parentde33edd1bc445baf58f045414b4d247b0964be2c (diff)
Check that the hwpack's format is supported before trying to do anything with it.
Diffstat (limited to 'linaro-hwpack-install')
-rwxr-xr-xlinaro-hwpack-install12
1 files changed, 12 insertions, 0 deletions
diff --git a/linaro-hwpack-install b/linaro-hwpack-install
index 12cb363..364fd97 100755
--- a/linaro-hwpack-install
+++ b/linaro-hwpack-install
@@ -28,6 +28,7 @@ HWPACK_DIR="${TEMP_DIR}/unpacked"
INSTALL_LATEST="no"
SOURCES_LIST_FILE="${TEMP_DIR}/sources.list"
APT_GET_OPTIONS="Dir::Etc::SourceList=${SOURCES_LIST_FILE}"
+SUPPORTED_FORMATS="1.0" # A space-separated list of hwpack formats.
die() {
echo -e "$@"
@@ -75,6 +76,17 @@ echo -n "Unpacking hardware pack ..."
tar zxf "$HWPACK_TARBALL" -C "$HWPACK_DIR"
echo "Done"
+# Check the format of the hwpack is supported.
+hwpack_format=$(cat ${HWPACK_DIR}/FORMAT)
+supported="false"
+for format in $SUPPORTED_FORMATS; do
+ if [ $hwpack_format == $format ]; then
+ supported="true"
+ break
+ fi
+done
+[ $supported == "true" ] || die "Unsupported hwpack format: $hwpack_format"
+
# Check the architecture of the hwpack matches that of the host system.
HWPACK_ARCH=`grep ARCHITECTURE "${HWPACK_DIR}/metadata" | cut -d "=" -f2`
[ "$HWPACK_ARCH" == `dpkg --print-architecture` ] || \