From 75b8f418b3965132167305d916c9843301eacea2 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Fri, 1 Nov 2019 00:16:46 +0100 Subject: Add `set -e` to build script To ensure that the build stops after build errors. Also fixed several minor issues in the script to ensure that the build process mostly runs successfully with and doesn't break due to file operations when preparing the build env. --- kernel/build.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/kernel/build.sh b/kernel/build.sh index 9d48229..a128366 100755 --- a/kernel/build.sh +++ b/kernel/build.sh @@ -1,4 +1,5 @@ #! /usr/bin/env bash +set -e ASM_PATH="src/" TARGET_PATH="target" @@ -20,12 +21,12 @@ cleanup_target() { } create_target() { - mkdir $TARGET_PATH &> /dev/null - mkdir $TMP_PATH &> /dev/null + mkdir -p $TARGET_PATH + mkdir -p $TMP_PATH } cleanup_temp() { - rm -f $TMP_PATH/* &> /dev/null + rm -r $TMP_PATH/* &>/dev/null ||: } # --------------------------------------------------- @@ -44,9 +45,7 @@ build_kernel_iso() { build_kernel_elf fi create_target - mkdir $TMP_PATH/isofiles &> /dev/null - mkdir $TMP_PATH/isofiles/boot &> /dev/null - mkdir $TMP_PATH/isofiles/boot/grub &> /dev/null + mkdir -p $TMP_PATH/isofiles/boot/grub cp $TARGET_PATH/kernel.bin $TMP_PATH/isofiles/boot &> /dev/null cp $GRUB_CFG_PATH $TMP_PATH/isofiles/boot/grub/grub.cfg &> /dev/null [ -d "$GRUB_i386" ] || { echo "Grub img $GRUB_i386 does not exist!"; exit 1; } -- cgit v1.2.3-70-g09d2