diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2019-11-01 00:16:46 +0100 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2019-11-01 00:17:57 +0100 |
commit | 75b8f418b3965132167305d916c9843301eacea2 (patch) | |
tree | ed2ebf91b140edf86a9849f098e3c175d0c3f58f | |
parent | 86fd2c1e6a602a1086d164b1ab2676c91b3684c6 (diff) |
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.
-rwxr-xr-x | kernel/build.sh | 11 |
1 files 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; } |