mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-04-05 00:27:25 +00:00
Simplify ehdd mount/umount code
This commit is contained in:
parent
8838d5af82
commit
9eacf3fe3f
@ -24,3 +24,18 @@ keyfile_option() {
|
||||
echo "--key-file $EHDD_KEYFILE"
|
||||
fi
|
||||
}
|
||||
|
||||
hdd_exists() {
|
||||
[ -e "$EHDD_IMG" ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
is_mounted() {
|
||||
[ ! -e "$EHDD_IMG" ] && return 1
|
||||
if mount | grep "^/dev/mapper/$EHDD_LUKS_NAME on $EHDD_MOUNTPOINT" >/dev/null; then
|
||||
# mounted
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ if [ ! -e "$EHDD_IMG" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if mount | grep "^/dev/mapper/$EHDD_LUKS_NAME on $EHDD_MOUNTPOINT" >/dev/null; then
|
||||
if is_mounted; then
|
||||
echo "$EHDD_IMG already mounted"
|
||||
exit 0
|
||||
fi
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
. "ehdd/ehdd_funcs.sh" || exit 1
|
||||
|
||||
if ! mount | grep "$EHDD_MOUNTPOINT" >/dev/null; then
|
||||
|
||||
if ! is_mounted; then
|
||||
# not mounted
|
||||
exit 0
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user