1#!/bin/bash
2
3# Copyright (C) 2020 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17echo Pack AVD images from ANDROID_PRODUCT_OUT to $HOME/Downloads/x86_64
18
19if [[ -z $ANDROID_PRODUCT_OUT ]]; then
20    echo "err: please set ANDROID_PRODUCT_OUT='/android/out/target/product/generic_x86_64'"
21    exit
22fi
23
24if [[ -z $ANDROID_BUILD_TOP ]]; then
25    echo "err: please set ANDROID_BUILD_TOP='/android'"
26    exit
27fi
28
29# Defaults
30if [[ -z $OUT_DIR ]]; then
31    OUT_DIR="$HOME/Downloads/x86_64"
32fi
33
34if [[ -z $AVD_IMAGE_ZIP ]]; then
35    AVD_IMAGE_ZIP="$HOME/Downloads/my_aosp_car_x86_64-qt-v123456.zip"
36fi
37
38echo Delete $OUT_DIR
39rm -rf $OUT_DIR
40
41echo Packing AVD images
42OUT_DIR=$OUT_DIR \
43    AVD_IMAGE_ZIP=$AVD_IMAGE_ZIP \
44    $ANDROID_BUILD_TOP/device/generic/car/tools/pack_avd_img.sh
45