From 43ee622f20fa5fc75402a1caf165f07b724c2bed Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Wed, 14 Jun 2017 16:39:46 +0200 Subject: [PATCH] Add support to download architecture specific image --- snapcraft.yaml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/snapcraft.yaml b/snapcraft.yaml index 3ed6b2b..00503d4 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -25,13 +25,36 @@ apps: parts: android-images: plugin: dump + # This needs to be any directory but not the root one as if we use + # it we get superious permissions errors with the copied .git tree + source: data build-packages: - wget install: | + IMAGE_PATH= + IMAGE_NAME= + ARCH=$(uname -m) + + case "$ARCH" in + x86_64) + IMAGE_PATH="2017/04/12" + IMAGE_NAME="android_1_amd64" + ;; + arm*) + IMAGE_PATH="2017/06/12" + IMAGE_NAME="android_1_armhf" + ;; + esac + + if [ -z "$IMAGE_PATH" ] || [ -z "$IMAGE_NAME" ]; then + echo "ERROR: Unknown architecture $ARCH" + exit 1 + fi + # FIXME: downloading with a source: field doesn't work as snapcraft # expects the downloaded file to be an archive it can extract. - wget http://build.anbox.io/android-images/2017/04/12/android_1_amd64.img - mv android_1_amd64.img $SNAPCRAFT_PART_INSTALL/android.img + wget http://build.anbox.io/android-images/$IMAGE_PATH/$IMAGE_NAME.img + mv $IMAGE_NAME.img $SNAPCRAFT_PART_INSTALL/android.img prime: - android.img anbox-common: