qemu_binary function to seach qemu binary similar to x86/run does so that it can be reused for all arches Signed-off-by: Balamuruhan S <bala24@xxxxxxxxxxxxxxxxxx> --- scripts/arch-run.bash | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index 94c50f3..404a4c0 100644 --- a/scripts/arch-run.bash +++ b/scripts/arch-run.bash @@ -133,3 +133,25 @@ migration_cmd () echo "run_migration" fi } + +# qemu binary search function for all arches +qemu_binary () +{ + PATH=$PATH:/usr/libexec + qemubinarysearch="${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}" + for qemucmd in ${qemubinarysearch} + do + unset QEMUFOUND + unset qemu + if ! [ -z "${QEMUFOUND=$(${qemucmd} --help 2>/dev/null | grep "QEMU")}" ] + then + qemu="${qemucmd}" + break + fi + done + + if [ -z "${QEMUFOUND}" ]; then + echo "A QEMU binary was not found, You can set a custom location by using the QEMU=<path> environment variable" + exit 2 + fi +} -- 2.7.4