Skip to content

Add check if dependencies exists #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions scripts/qemu.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
#!/bin/bash

# Check that all the dependencies are installed
QEMU=qemu-system-i386
GRUB_MKRESCUE=grub-mkrescue


# Check if a program exists
# $1 => program name
check_program() {
if ! command -v "${1}" &> /dev/null
then
echo "${1} could not be found."
exit 1
fi
}

check_program $QEMU
check_program $GRUB_MKRESCUE



# Build ISO
mkdir -p iso/boot/grub
cp $1 iso/boot/maestro
cp grub.cfg iso/boot/grub
grub-mkrescue -o kernel.iso iso
${GRUB_MKRESCUE} -o kernel.iso iso



Expand All @@ -19,7 +37,9 @@ if [ -f $QEMU_DISK ]; then
QEMUFLAGS="-drive file=$QEMU_DISK,format=raw $QEMUFLAGS"
fi

qemu-system-i386 -cdrom kernel.iso $QEMUFLAGS >qemu.log 2>&1


${QEMU} -cdrom kernel.iso $QEMUFLAGS >qemu.log 2>&1
EXIT=$?

if [ "$EXIT" -ne 33 ]; then
Expand Down