]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
change check device in method
authorBastian Dehn <hhaalo@arcor.de>
Sun, 25 May 2025 06:34:06 +0000 (08:34 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 25 May 2025 06:34:06 +0000 (08:34 +0200)
backupmount

index fd82f5f402812376fa4ae50b1f0821fa5c536c53..a175437fa880b3182ac842c948f66f3938ca9096 100755 (executable)
@@ -12,9 +12,19 @@ errlog()
 
 infolog()
 {
+       local lastexit=$?
        local msg="$1"
 
        echo "ℹ️  INFO: $msg"
+       return $lastexit
+}
+
+device_mount()
+{
+       local device="$1"
+       [ -b "$device" ] \
+               || infolog "block device $device not found" \
+               || return $?
 }
 
 mount()
@@ -34,9 +44,10 @@ mount()
                [ "$device" != "null" ] \
                        || errlog "missing path for $media" \
                        || return $?
-               [ -b "$device" ] \
-                       || infolog "block device $device not found"
+               device_mount "$device" && return 0
        done
+
+       errlog "no device found"
 }
 
 main()