diff --git a/lib/image-helpers.sh b/lib/image-helpers.sh index 2e75010238..5f5ca26f4d 100644 --- a/lib/image-helpers.sh +++ b/lib/image-helpers.sh @@ -91,14 +91,14 @@ write_uboot() { local loop=$1 revision display_alert "Writing U-boot bootloader" "$loop" "info" - mkdir -p /tmp/u-boot/ + TEMP_DIR=$(mktemp -d || exit 1) + chmod 700 ${TEMP_DIR} revision=${REVISION} [[ -n $UPSTREM_VER ]] && revision=${UPSTREM_VER} - dpkg -x "${DEB_STORAGE}/${CHOSEN_UBOOT}_${revision}_${ARCH}.deb" /tmp/u-boot/ - write_uboot_platform "/tmp/u-boot/usr/lib/${CHOSEN_UBOOT}_${revision}_${ARCH}" "$loop" + dpkg -x "${DEB_STORAGE}/${CHOSEN_UBOOT}_${revision}_${ARCH}.deb" ${TEMP_DIR}/ + write_uboot_platform "${TEMP_DIR}/usr/lib/${CHOSEN_UBOOT}_${revision}_${ARCH}" "$loop" [[ $? -ne 0 ]] && exit_with_error "U-boot bootloader failed to install" "@host" - rm -r /tmp/u-boot/ - sync + rm -rf ${TEMP_DIR} } ############################################################################# customize_image()