trefuses to open a tomb that is already open - tomb - the crypto undertaker
HTML git clone git://parazyd.org/tomb.git
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit bf9cc3070d9c5b352d6f94f42ff3d7554efba8c7
DIR parent e9e584a9c2b9038780a62ed0dc7ca5cbc6d409db
HTML Author: Jaromil <jaromil@dyne.org>
Date: Thu, 26 May 2011 13:15:03 +0200
refuses to open a tomb that is already open
Diffstat:
M src/tomb | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
---
DIR diff --git a/src/tomb b/src/tomb
t@@ -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
t@@ -460,6 +460,7 @@ create_tomb() {
}
mount_tomb() {
+ notice "Commanded to open tomb $CMD2"
get_arg_tomb $CMD2
if [ $? != 0 ]; then
error "operation aborted."
t@@ -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