From 8a613f2e9eaa326b8c9baa5200a1f85de1c6ebba Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 14 Jul 2016 20:40:53 +0200 Subject: mountpoint und findmnt statt grep-Magie --- cryptfs.in | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cryptfs.in b/cryptfs.in index d184a9c..db4403c 100644 --- a/cryptfs.in +++ b/cryptfs.in @@ -25,7 +25,7 @@ start) for neededKeyFs in ${neededKeyFss} do - if ! mount | grep -q "^\S\+\s\+on\s\+${neededKeyFs}\s" + if ! mountpoint -q "${neededKeyFs}" then if echo "${fsTab}" | grep -q "^\(ssh\|ftp\)fs#\S*\s\+${neededKeyFs}\s" then @@ -59,10 +59,10 @@ start) for cryptedFs in ${cryptedFss} do - if ! mount | grep -q "^${cryptedFs}\s" + if ! findmnt --source "${cryptedFs}" > /dev/null then - e2fsck ${cryptedFs} - mount ${cryptedFs} || exit $? + e2fsck "${cryptedFs}" + mount "${cryptedFs}" || exit $? fi done @@ -72,9 +72,9 @@ stop) for cryptedFs in ${cryptedFss} do - if mount | grep -q "^${cryptedFs}\s" + if findmnt --source "${cryptedFs}" > /dev/null then - umount ${cryptedFs} || exit $? + umount "${cryptedFs}" || exit $? fi done @@ -88,7 +88,7 @@ stop) for neededKeyFs in ${neededKeyFss} do - if [ ! "${neededKeyFs}" == "/" ] && mount | grep -q "^\S\+\s\+on\s\+${neededKeyFs}\s" + if [ ! "${neededKeyFs}" == "/" ] && mountpoint -q "${neededKeyFs}" then umount ${neededKeyFs} || exit $? fi -- cgit v1.2.3-70-g09d2