From 929fb17fa913c7b1797a7b07fbc08b83ac418f14 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Wed, 9 Mar 2016 14:44:44 +0100 Subject: Refactor organize_boot_files Change-Id: Id5dd61e76cea58d2ef8b33e1142c35945433dba1 Reviewed-by: Gatis Paeglis --- qt-ostree/qt-ostree | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'qt-ostree') diff --git a/qt-ostree/qt-ostree b/qt-ostree/qt-ostree index 8e016fe..191835a 100755 --- a/qt-ostree/qt-ostree +++ b/qt-ostree/qt-ostree @@ -349,31 +349,34 @@ clean_workdir() rm -rf fakepath } -find_and_rename_kernel() +organize_boot_files() { + cp ${INITRAMFS} ${BOOT_FILE_PATH}/initramfs + + # Find kernel image. cd ${BOOT_FILE_PATH}/ + kernel_found=false for file in *; do if file -b $file | grep -qi "kernel"; then echo "Found kernel image ${BOOT_FILE_PATH}/${file}" - mv ${file} vmlinuz - return 0 + kernel_found=true + if [ "${file}" != "vmlinuz" ] ; then + # Rename as OSTree expects that kernel image is named 'vmlinuz'. + mv ${file} vmlinuz + fi + break fi done - echo "error: Failed to find kernel image in ${BOOT_FILE_PATH}." - exit_qt_ostree 1 -} - -organize_boot_files() -{ - cp ${INITRAMFS} ${BOOT_FILE_PATH}/initramfs - find_and_rename_kernel + if [ $kernel_found = false ] ; then + echo "error: Failed to find kernel image in ${BOOT_FILE_PATH}." + exit_qt_ostree 1 + fi # Boot loader companions. if [[ "${BOOTLOADER}" = "u-boot" && -n "${UBOOT_ENV_FILE}" ]] ; then cp ${UBOOT_ENV_FILE} ${BOOT_FILE_PATH}/ name=$(basename ${UBOOT_ENV_FILE}) if [ "${name}" != "uEnv.txt" ] ; then - cd ${BOOT_FILE_PATH} # Must be a boot script then. if file -b $name | grep -qi "ASCII text"; then echo "Compiling u-boot boot script: ${BOOT_FILE_PATH}/${name} ..." -- cgit v1.2.3