summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-10-29 21:00:06 +0100
committerErich Eckner <git@eckner.net>2017-10-29 21:00:06 +0100
commit5642bb6fe16fccc2afb7b313c8fbef8a4d67efdf (patch)
treeea2a08e71a43dc585934cfd9e4acaee69e463a45
parentf810d99c6106f95ce014ad174fa76ec67368ec6a (diff)
downloadcryptfs-daemon-5642bb6fe16fccc2afb7b313c8fbef8a4d67efdf.tar.xz
cryptfs.bin: 10 Versuche zum Einhängen und luks-Öffnen, sowie beliebig viele Versuche zum Aushängen und luks-Schließen
-rw-r--r--cryptfs.bin.in33
1 files changed, 29 insertions, 4 deletions
diff --git a/cryptfs.bin.in b/cryptfs.bin.in
index 9e8e1e7..8bfa29a 100644
--- a/cryptfs.bin.in
+++ b/cryptfs.bin.in
@@ -147,6 +147,8 @@ is_unlocked() {
do_mount() {
local inner_fs
+ local max_tries
+ local mount_paramters
if is_mounted "$1"; then
return
fi
@@ -176,7 +178,15 @@ do_mount() {
if [ -n "${inner_fs}" ]; then
do_unmount -l "${inner_fs}"
fi
- mount $(mount_details all "$1")
+ max_tries=10
+ mount_parameters=$(mount_details all "$1")
+ while ! mount ${mount_parameters}; do
+ max_tries=$((max_tries-1))
+ if [ ${max_tries} -le 0 ]; then
+ exit 1
+ fi
+ sleep 1
+ done
if [ -n "${inner_fs}" ]; then
do_mount "${inner_fs}"
fi
@@ -185,6 +195,7 @@ do_mount() {
do_unmount() {
local inner_fs
local lazy
+ local mount_point
if [ "x$1" = 'x-l' ]; then
lazy='-l'
shift
@@ -198,7 +209,11 @@ do_unmount() {
if [ -n "${inner_fs}" ]; then
do_unmount -l "${inner_fs}"
fi
- umount ${lazy} $(mount_details mp "$1")
+ mount_point=$(mount_details mp "$1")
+ while ! umount ${lazy} "${mount_point}"; do
+ fuser -k -M -m "${mount_point}"
+ sleep 1
+ done
if [ -n "${inner_fs}" ]; then
do_mount "${inner_fs}"
fi
@@ -206,13 +221,23 @@ do_unmount() {
do_crypt_close() {
if is_unlocked "$1"; then
- cryptsetup luksClose "$1"
+ while ! cryptsetup luksClose "$1"; do
+ sleep 1
+ done
fi
}
do_crypt_open() {
+ local max_tries
if ! is_unlocked "$1"; then
- cryptsetup luksOpen "$2" "$1" --key-file="$3"
+ max_tries=10
+ while ! cryptsetup luksOpen "$2" "$1" --key-file="$3"; do
+ sleep 1
+ max_tries=$((max_tries-1))
+ if [ ${max_tries} -le 0 ]; then
+ exit 1
+ fi
+ done
fi
}