]> gitweb.fluxo.info Git - bootless.git/commitdiff
Fix: additional checks
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 12 Jun 2022 17:40:44 +0000 (14:40 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 12 Jun 2022 17:40:44 +0000 (14:40 -0300)
files/bootless

index 900eb323bb1d1598f4e3d8fe19ae95210ad39665..a06c98d644c4cc00f7f336c3073d851f5197f55b 100755 (executable)
@@ -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