Currently, even if an error occurs during image creation, the script
does not abort, which may result in incorrect image creation. In order
to avoid confusion due to this, if any kind of error occurs during the
build process, the build will be stopped.
Change-Id: I8094f4b97128a8c754e5a9ff22f1b3395a3756b1
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
#!/bin/bash
+TMP_UBOOT_PATH=tmp_uboot
BOOT_PATH="rpi4/boot"
USER_ID=`id -u`
GROUP_ID=`id -g`
IS_64BIT=`cat .config | grep "CONFIG_64BIT=y"`
+BUILD_ROOT=$PWD
+
+cleanup() {
+ cd $BUILD_ROOT
+ if [ -e $TMP_UBOOT_PATH ]; then
+ rm -rf ${TMP_UBOOT_PATH}
+ fi
+
+ if [ -e tmp_modules ]; then
+ rm -rf tmp_modules
+ fi
+
+ if [ -e tmp/lib/modules ]; then
+ rm -rf tmp/lib/modules
+ fi
+
+ if [ -n "$(mount | grep ${BUILD_ROOT}/tmp)" ]; then
+ sudo umount tmp
+ fi
+
+ if [ -e tmp ]; then
+ rm -rf tmp
+ fi
+}
+
+trap cleanup EXIT
+
+set -e
rm -f boot.img
rm -rf tmp
fi
# install u-boot files extracted from u-boot-rpi4 rpm package in download.tizen.org.
-TMP_UBOOT_PATH=tmp_uboot
+
mkdir -p ${TMP_UBOOT_PATH}
pushd ${TMP_UBOOT_PATH}
if [ -n "$IS_64BIT" ]; then
fi
echo ${BOOT_TARBALL}
+
+set +e