summaryrefslogtreecommitdiff
path: root/cryptfs.bin.in
diff options
context:
space:
mode:
Diffstat (limited to 'cryptfs.bin.in')
-rw-r--r--cryptfs.bin.in16
1 files changed, 13 insertions, 3 deletions
diff --git a/cryptfs.bin.in b/cryptfs.bin.in
index 8465c70..4057651 100644
--- a/cryptfs.bin.in
+++ b/cryptfs.bin.in
@@ -189,22 +189,32 @@ do_mount() {
fi
inner_fs=$(inner_fs_to_mountorder "$1")
+ mount_dev=$(mount_details dev "$1")
+
+ if md_dev=$(readlink -e "${mount_dev}" \
+ | grep -x '/dev/md[0-9]\+'); then
+ if ! grep -qxF 'clean' '/sys/block/'"${md_dev##*/}"'/md/array_state'; then
+ >&2 printf '%s is not clean - will not mount\n' "${md_dev}"
+ exit 1
+ fi
+ fi
+
case "$(mount_details fs "$1")" in
'ext'*)
- if cryptsetup status $(mount_details dev "$1") \
+ if cryptsetup status "${mount_dev}" \
| grep -q '^\s*mode:\s\+readonly$'; then
e2fsck_option='-n'
else
e2fsck_option='-p'
fi
- e2fsck ${e2fsck_option} $(mount_details dev "$1")
+ e2fsck ${e2fsck_option} "${mount_dev}"
;;
'fuse.sshfs'|'fuse.ftps')
local max_wait
local host
max_wait=$(($(date +%s)+120))
host=$(
- mount_details dev "$1" | \
+ echo "${mount_dev}" | \
sed 's>^\([^:@]*@\)\?\([^:@]\+\):\S*$>\2>'
)
host=$(extract_ssh_host "${host}")