~ren/polymorphos

3394eaf3d8958ef70d687358c5aa624d394527d7 — Lauren Jenkinson 1 year, 6 days ago 1ec66b4
i686: Check for prefixed GRUB commands and use those if present
1 files changed, 10 insertions(+), 3 deletions(-)

M polymorph-i686/bootable.sh
M polymorph-i686/bootable.sh => polymorph-i686/bootable.sh +10 -3
@@ 15,7 15,11 @@ BUILD_TYPE="$3"
[ -e "${TARGET}" ] || die "Target spec doesn't exist!"
[ -e "${BUILD_ARTIFACT}" ] || die "Build artifact doesn't exist!"
[ -d "${CARGO_TARGET_DIR}" ] || die "CARGO_TARGET_DIR is not a directory!"
grub-file --is-x86-multiboot "${BUILD_ARTIFACT}" || die "Build artifact is not a Multiboot file!"

GRUB_FILE="grub-file"
which "i386-elf-grub-file" >/dev/null 2>/dev/null && GRUB_FILE="i386-elf-grub-file"

"${GRUB_FILE}" --is-x86-multiboot "${BUILD_ARTIFACT}" || die "Build artifact is not a Multiboot file!"

TARGET_TRIPLE="$(basename "$TARGET")"
TARGET_TRIPLE="${TARGET_TRIPLE%.*}"


@@ 33,7 37,10 @@ cat > "${WORKDIR}/boot/grub/grub.cfg" <<-EOF
    }
EOF

grub-mkrescue -o "${ISO_OUTPUT}" "${WORKDIR}" || die "Failed to create bootable ISO!"
GRUB_MKRESCUE="grub-mkrescue"
which "i386-elf-grub-mkrescue" >/dev/null 2>/dev/null && GRUB_MKRESCUE="i386-elf-grub-mkrescue"

"${GRUB_MKRESCUE}" -o "${ISO_OUTPUT}" "${WORKDIR}" || die "Failed to create bootable ISO!"
[ -e "${ISO_OUTPUT}" ] || "grub-mkrescue exited successfully but ISO is not present!"

echo "${ISO_OUTPUT}"
\ No newline at end of file
echo "${ISO_OUTPUT}"