summaryrefslogtreecommitdiffstats
path: root/qt-ostree
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@theqtcompany.com>2016-03-09 14:44:44 +0100
committerGatis Paeglis <gatis.paeglis@theqtcompany.com>2016-03-10 11:17:42 +0000
commit929fb17fa913c7b1797a7b07fbc08b83ac418f14 (patch)
tree6db82f353f1bc8c7c01f0ccfdfb24d617704d9fb /qt-ostree
parentb9878576a71c9df32ce59745f373455eb764d8b6 (diff)
Refactor organize_boot_files
Change-Id: Id5dd61e76cea58d2ef8b33e1142c35945433dba1 Reviewed-by: Gatis Paeglis <gatis.paeglis@theqtcompany.com>
Diffstat (limited to 'qt-ostree')
-rwxr-xr-xqt-ostree/qt-ostree27
1 files changed, 15 insertions, 12 deletions
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} ..."