tomb

the crypto undertaker
git clone git://parazyd.org/tomb.git
Log | Files | Refs | README | LICENSE

commit bf9cc3070d9c5b352d6f94f42ff3d7554efba8c7
parent e9e584a9c2b9038780a62ed0dc7ca5cbc6d409db
Author: Jaromil <jaromil@dyne.org>
Date:   Thu, 26 May 2011 13:15:03 +0200

refuses to open a tomb that is already open

Diffstat:
Msrc/tomb | 18+++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/tomb b/src/tomb @@ -191,7 +191,7 @@ get_arg_tomb() { fi tombname=${tombfile%%\.*} - act "tomb found: ${tombdir}/${tombfile}" + func "tomb found: ${tombdir}/${tombfile}" # now check if the key is kept beside or in args # we use the extension .key @@ -460,6 +460,7 @@ create_tomb() { } mount_tomb() { + notice "Commanded to open tomb $CMD2" get_arg_tomb $CMD2 if [ $? != 0 ]; then error "operation aborted." @@ -481,8 +482,23 @@ mount_tomb() { tombmount=$CMD3 fi + # check if its already open + mount -l | grep "${tombname}.tomb.*\[$tombname\]$" 2>&1 > /dev/null + if [ $? = 0 ]; then + error "$tombname is already mounted on $tombmount" + act "tomb list - show all tombs currently open" + if [ -n "$usbkey_mount" ]; then + umount $usbkey_mount + rmdir $usbkey_mount + unset usbkey_mount + fi + error "operation aborted." + return 1 + fi + notice "mounting $tombfile on mountpoint $tombmount" + # we need root from here on mkdir -p $tombmount