diff options
Diffstat (limited to 'projects')
-rwxr-xr-x | projects/grub/grub | 30 | ||||
-rwxr-xr-x | projects/grub/grub-helper | 11 |
2 files changed, 20 insertions, 21 deletions
diff --git a/projects/grub/grub b/projects/grub/grub index 16b63634..c444841b 100755 --- a/projects/grub/grub +++ b/projects/grub/grub @@ -75,29 +75,21 @@ build() { grub_build_utils + if [[ "${target}" == 'bios' ]]; then + grub_build_floppy_image + else + grub_build_standalone_image + fi + for raw_keymap in "${raw_keymap_path}"/*; do grub_build_layout "${raw_keymap}" done - case "${target}" in - bios) - grub_build_floppy_image - grub_build_font - grub_copy_modules - ;; - *) - grub_build_standalone_image - grub_build_font - grub_copy_modules - ;; - esac - - # Temporary until the function project_make_distclean is written - ( - cd "${sources_path}" || return - - make distclean - ) + grub_build_font + + grub_copy_modules + + make -C "${sources_path}" distclean } build_check() { diff --git a/projects/grub/grub-helper b/projects/grub/grub-helper index e7e8a1fe..604d4a54 100755 --- a/projects/grub/grub-helper +++ b/projects/grub/grub-helper @@ -114,6 +114,10 @@ grub_build_layout() { if ! [[ -e "${keymap_out_path}" ]]; then mkdir -p "${keymap_out_path}" + elif ! [[ -d "${keymap_out_path}" ]]; then + printf '\n%s\n' "Error: File ${keymap_out_path} is not a directory" 1>&2 + + return 1 fi "${grub_mklayout}" --output="${grub_kbd_layout}" --input="${raw_layout_path}" @@ -148,8 +152,9 @@ grub_build_floppy_image() { local grubimg="${build_path}/grub2" local tempfile="${build_path}/temp.file" - if ! ( grub_build_bootable_image "$@" ); then + if ! grub_build_bootable_image "$@"; then printf '\n%s\n\n' "Error: Failed to build a GRUB image" 1>&2 + return 1 fi @@ -161,6 +166,7 @@ grub_build_floppy_image() { dd if=/dev/zero of="${tempfile}" bs=1024 count="${size:-160}" else printf '\n%s\n\n' "Error: File ${tempfile} already exists!" 1>&2 + return 1 fi @@ -175,7 +181,8 @@ grub_build_floppy_image() { mv "${tempfile}" "${grubimg}" else printf '\n%s' "Error: Image ${grubimg##*/} is too large; " 1>&2 - printf '%s\n\n' "it must be less than ${size}KiB in size." 1>&2 + printf '%s\n\n' "it must be less than ${size}KiB in size" 1>&2 + return 1 fi } |