From 35a502e10ddbb2f20e58b558e63439938bd0af5a Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 12 Jun 2022 14:40:44 -0300 Subject: Fix: additional checks --- files/bootless | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/files/bootless b/files/bootless index 900eb32..a06c98d 100755 --- a/files/bootless +++ b/files/bootless @@ -158,8 +158,13 @@ function bootless_image { bootless_rsync ${BOOTLESS_DIR} ${tmpdir}/boot # Make rescue disk + echo "Generating the rescue image..." grub-mkrescue -o ${output} ${tmpdir} + # Check rescue disk + echo "Generated image details:" + xorriso -indev ${output} -toc + # Optionally copy to removable media if [ ! -z "$device" ]; then # Issue a warning @@ -207,6 +212,16 @@ function bootless_check { exit 1 } +# Check dependencies +function bootless_check_dependencies { + for dependency in $DEPENDENCIES; do + if ! which $dependency 2> /dev/null; then + echo "$NAME: unmet dependency $dependency, please install it" + exit 1 + fi + done +} + # Load bootless_load $* @@ -215,10 +230,14 @@ NAME="bootless" BOOTLESS_VERSION="0.0.1" BOOTLESS_ACTION="$1" BOOTLESS_DIR="$2" +DEPENDENCIES="xorriso grub-mkrescue rsync dd" # Output name and version echo "$NAME $BOOTLESS_VERSION" +# Check dependencies +bootless_check_dependencies + # Parameter verification if [ -z "$BOOTLESS_DIR" ]; then bootless_usage -- cgit v1.2.3