From: Bastian Dehn Date: Sun, 25 May 2025 06:34:06 +0000 (+0200) Subject: change check device in method X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=d4625611df0cc168bcd21103583789e7ccc76fe1;p=simple-backup.git change check device in method --- diff --git a/backupmount b/backupmount index fd82f5f..a175437 100755 --- a/backupmount +++ b/backupmount @@ -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()