Added cleanup-functionality to build.sh

This commit is contained in:
Eric-Paul Ickhorn 2023-05-29 23:43:16 +02:00
parent 1ad60a7351
commit 3a90af4704
1 changed files with 24 additions and 4 deletions

View File

@ -4,6 +4,20 @@
set -e
PROJECT_ROOT=$PWD
OVMF_PATH=" "
if [[ -f "/usr/share/ovmf/x64/OVMF.fd" ]]; then
OVMF_PATH="/usr/share/ovmf/x64/OVMF.fd"
elif [[ -f "/usr/share/OVMF/OVMF.fd" ]]; then
OVMF_PATH="/usr/share/OVMF/OVMF.fd"
elif [[ -f "$PROECT_ROOT/build/ovmf/x64/OVMF.fd" ]]; then
OVMF_PATH="$PROECT_ROOT/build/ovmf/x64/OVMF.fd"
else
echo "Could not find OVMF-file! Did search at:"
echo "1) /usr/share/ovmf/x64/OVMF.fd"
echo "2) /usr/share/OVMF/OVMF.fd"
echo "3) $PROECT_ROOT/build/OVMF/x64/OVMF.fd"
exit 255
fi
workspace_setup() {
echo " --> Setting up workspace"
@ -26,14 +40,12 @@ check_toolchain() {
echo " |--> found xorriso"
hash qemu-system-x86_64
echo " |--> found qemu"
[ ! -d "/usr/share/ovmf/x64/" ] && echo "OVMF binaries not found!" && exit 255
echo " |--> found ovmf"
echo " --> All checks passed"
}
kernel_build() {
echo " --> Building kernel"
cd build/cmake
@ -97,12 +109,20 @@ generate_image() {
echo ""
}
cleanup_files() {
rm -Rf build/
}
echo "!=====[ NOXOS build script ]=====!"
case $1 in
"check")
check_toolchain
;;
"cleanup")
cleanup_files
;;
*)
workspace_setup
kernel_build