image_builder: use IMAGE_PATH in get_image

This commit is contained in:
Artem Smirnov
2018-08-21 18:02:02 +03:00
parent 4850d03825
commit 916ad43f4e

View File

@@ -30,20 +30,20 @@ echo_stamp() {
}
get_image() {
# TEMPLATE: get_image $BUILD_DIR $RPI_DONWLOAD_URL $IMAGE_NAME
# TEMPLATE: get_image <IMAGE_PATH> <RPI_DONWLOAD_URL>
local BUILD_DIR=$(dirname $1)
local RPI_ZIP_NAME=$(basename $2)
if [ ! -e "$1/${RPI_ZIP_NAME}" ];
if [ ! -e "${BUILD_DIR}/${RPI_ZIP_NAME}" ];
then
echo_stamp "1. Downloading original Linux distribution"
wget -nv -O $1/${RPI_ZIP_NAME} $2
wget -nv -O ${BUILD_DIR}/${RPI_ZIP_NAME} $2
echo_stamp "Downloading complete" "SUCCESS"
else
echo_stamp "1. Linux distribution already donwloaded"
fi
echo_stamp "2. Unzipping Linux distribution image"
local RPI_IMAGE_NAME=$(echo ${RPI_ZIP_NAME} | sed 's/zip/img/')
unzip -p $1/${RPI_ZIP_NAME} ${RPI_IMAGE_NAME} > $1/$3
unzip -p ${BUILD_DIR}/${RPI_ZIP_NAME} ${RPI_IMAGE_NAME} > $1
echo_stamp "Unzipping complete" "SUCCESS"
}
@@ -287,8 +287,8 @@ echo "==========================================================================
case "$1" in
get_image)
# get_image <BUILD_DIR> <RPI_DONWLOAD_URL> <IMAGE_NAME>
get_image $2 $3 $4;;
# get_image <IMAGE_PATH> <RPI_DONWLOAD_URL>
get_image $2 $3;;
resize_fs)
# resize_fs <IMAGE_PATH> <SIZE>