qemu-boot.sh now checks for required packages.
This commit is contained in:
@@ -21,6 +21,26 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
checkDependencies() {
|
||||||
|
local missingCommands=()
|
||||||
|
local command
|
||||||
|
|
||||||
|
for command in qemu-system-x86_64 qemu-img date dirname find sort head cut mkdir; do
|
||||||
|
if ! command -v "$command" &> /dev/null; then
|
||||||
|
missingCommands+=("$command")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if (( ${#missingCommands[@]} > 0 )); then
|
||||||
|
echo "Error: Missing required commands:"
|
||||||
|
printf ' %s\n' "${missingCommands[@]}"
|
||||||
|
echo
|
||||||
|
echo "On Arch Linux, install the required packages with:"
|
||||||
|
echo " sudo pacman -S qemu-system-x86 qemu-img qemu-ui-gtk qemu-audio-pa coreutils findutils"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Parse command line arguments
|
# Parse command line arguments
|
||||||
bootInstalled=false
|
bootInstalled=false
|
||||||
while getopts "ih" opt; do
|
while getopts "ih" opt; do
|
||||||
@@ -44,6 +64,8 @@ while getopts "ih" opt; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
checkDependencies
|
||||||
|
|
||||||
# Get the directory where this script is located
|
# Get the directory where this script is located
|
||||||
scriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
scriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
outDir="${scriptDir}/out"
|
outDir="${scriptDir}/out"
|
||||||
|
|||||||
Reference in New Issue
Block a user