]> gitweb.fluxo.info Git - bootless.git/commitdiff
Fix: bootless_image: check whether the device exists
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 4 Jul 2024 23:00:33 +0000 (20:00 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 4 Jul 2024 23:00:33 +0000 (20:00 -0300)
files/bootless

index 0dffd6cad964c09c5cc9d2f53ad34dee9a4178ed..60c649ebfdd9c757c0bc1c3315aa61a8aa49bf8b 100755 (executable)
@@ -173,8 +173,12 @@ function bootless_image {
     if [ "$?" != "0" ]; then
       echo "Skipping copy of ${output} to ${device}..."
     else
+      # Check if device exists
+      if [ ! -e "${device}" ]; then
+        echo "Error: device \"${device}\" does not exist."
+        echo "Skipping copy of ${output} to ${device}..."
       # Check if device is mounted
-      if [ "`mount | grep ${device}`" != "" ]; then
+      elif [ "`mount | grep ${device}`" != "" ]; then
         echo "Error: device \"${device}\" is mounted."
         echo "Skipping copy of ${output} to ${device}..."
       else