build.sh adjust some syntax, make it more robust

This commit is contained in:
Attila Lendvai 2023-03-22 09:55:12 +01:00
parent b5ccc504d4
commit f23ce0d6bd
No known key found for this signature in database
GPG Key ID: FEFA9FE55CF6E3CD

View File

@ -6,8 +6,8 @@ TARGET_ARCHITECTURE=$1
TARGET_VARIANT=$2 TARGET_VARIANT=$2
TARGET_DEVICE=$3 TARGET_DEVICE=$3
BUILD=`dirname "$0"`"/build/" BUILD="$(dirname "${0}")/build/"
BUILD=`readlink -f $BUILD` BUILD="$(readlink -f "${BUILD}")"
### ###
### chose a release ### chose a release
@ -59,28 +59,28 @@ SAVE_SPACE_PACKAGES=""
PREINSTALLED_PACKAGES+=${SAVE_SPACE_PACKAGES} PREINSTALLED_PACKAGES+=${SAVE_SPACE_PACKAGES}
mkdir -pv ${BUILD} mkdir -pv "${BUILD}"
rm -rf $IMGTEMPDIR rm -rf "${IMGTEMPDIR}"
cp -r image-extras/common/ $IMGTEMPDIR cp -r image-extras/common/ "${IMGTEMPDIR}"
PER_PLATFORM_IMAGE_EXTRAS=image-extras/${TARGET_DEVICE}/ PER_PLATFORM_IMAGE_EXTRAS="image-extras/${TARGET_DEVICE}/"
if [ -e $PER_PLATFORM_IMAGE_EXTRAS ]; then if [ -e "${PER_PLATFORM_IMAGE_EXTRAS}" ]; then
rsync -pr $PER_PLATFORM_IMAGE_EXTRAS $IMGTEMPDIR/ rsync -pr "${PER_PLATFORM_IMAGE_EXTRAS}" "${IMGTEMPDIR}/"
fi fi
if [ ! -e ${IMGBUILDER_DIR} ]; then if [ ! -e "${IMGBUILDER_DIR}" ]; then
pushd ${BUILD} pushd "${BUILD}"
# --no-check-certificate if needed # --no-check-certificate if needed
wget --continue ${IMGBUILDERURL} wget --continue "${IMGBUILDERURL}"
xz -d <${IMGBUILDER_ARCHIVE} | tar vx xz -d <"${IMGBUILDER_ARCHIVE}" | tar vx
popd popd
fi fi
pushd ${IMGBUILDER_DIR} pushd "${IMGBUILDER_DIR}"
make image PROFILE=${TARGET_DEVICE} PACKAGES="${PREINSTALLED_PACKAGES}" FILES=${IMGTEMPDIR} make image PROFILE=${TARGET_DEVICE} PACKAGES="${PREINSTALLED_PACKAGES}" FILES=${IMGTEMPDIR}
pushd bin/targets/${TARGET_ARCHITECTURE}/ pushd "bin/targets/${TARGET_ARCHITECTURE}/"
ln -s ../../../packages . ln -s ../../../packages .
popd popd