summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2015-05-25 15:57:19 (EDT)
committer P. J. McDermott <pj@pehjota.net>2015-05-25 15:57:19 (EDT)
commit50b6588d6350c7b15ffbcf5e0e704461861a8870 (patch)
treeea9715b09073ca89e0f96eb0c0edd5155e365c15 /lib
parent49cde26149b3aab7a2c7ca4cef2c827f6eb1256d (diff)
check_block(): New function
Diffstat (limited to 'lib')
-rw-r--r--lib/block.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/block.sh b/lib/block.sh
index 3911c3a..d83572e 100644
--- a/lib/block.sh
+++ b/lib/block.sh
@@ -32,14 +32,21 @@ is_block()
return ${?}
}
-block_mount()
+check_block()
{
local dev="${1}"
- local dir=
if ! [ -b "${dev}" ]; then
error 2 "$(get_msg 'block_device_invalid')"
fi
+}
+
+block_mount()
+{
+ local dev="${1}"
+ local dir=
+
+ check_block "${dev}"
rand
dir="$(get_vardata_dir 'mount')/block-$(printf '%010d' ${rand_x})"