commit 2bc7e4319831a64ef46deb79a88e8ac937e09ca4
parent 8832471170e97bf71ff9a51e54e4915602cb1868
Author: Jaromil <jaromil@dyne.org>
Date:   Tue, 14 Feb 2017 10:58:35 +0100
Merge pull request #245 from Arusekk/master
Totally fixed spaces handling in tomb and tomber
Diffstat:
| M | tomb |  |  | 24 | ++++++++++++------------ | 
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/tomb b/tomb
@@ -242,9 +242,9 @@ _plot() {
 
     TOMBFILE=$(basename $TOMBPATH)
 
-    # The tomb name is TOMBFILE without an extension.
-    # It can start with dots: ..foo.tomb -> ..foo
-    TOMBNAME="${TOMBFILE%\.[^\.]*}"
+    # The tomb name is TOMBFILE without an extension and underscores instead of spaces (for mount and cryptsetup)
+    # It can start with dots: ..foo bar baz.tomb -> ..foo_bar_baz
+    TOMBNAME=${${TOMBFILE// /_}%.*}
     [[ -z $TOMBNAME ]] && {
         _failure "Tomb won't work without a TOMBNAME." }
 
@@ -1071,7 +1071,7 @@ ask_key_password() {
 # call cryptsetup with arguments using the currently known secret
 # echo flags eliminate newline and disable escape (BSD_ECHO)
 _cryptsetup() {
-    print -R -n - "$TOMBSECRET" | _sudo cryptsetup --key-file - ${=@}
+    print -R -n - "$TOMBSECRET" | _sudo cryptsetup --key-file - ${@}
     return $?
 }
 
@@ -2306,7 +2306,7 @@ search_tombs() {
             # Use swish-e to search over contents
             [[ $SWISH == 1 && -r $tombmount/.swish ]] && {
                 _message "Searching contents in tomb ::1 tomb name::" $tombname
-                swish-e -w ${=@} -f $tombmount/.swish -H0 }
+                swish-e -w ${@} -f $tombmount/.swish -H0 }
         } || {
             _warning "Skipping tomb ::1 tomb name::: not indexed." $tombname
             _warning "Run 'tomb index' to create indexes." }
@@ -2711,22 +2711,22 @@ main() {
 
         # CREATE Step 1: dig -s NN file.tomb
         dig)
-            dig_tomb ${=PARAM}
+            dig_tomb $PARAM
             ;;
 
         # CREATE Step 2: forge file.tomb.key
         forge)
-            forge_key ${=PARAM}
+            forge_key $PARAM
             ;;
 
         # CREATE Step 2: lock -k file.tomb.key file.tomb
         lock)
-            lock_tomb_with_key ${=PARAM}
+            lock_tomb_with_key $PARAM
             ;;
 
         # Open the tomb
         mount|open)
-            mount_tomb ${=PARAM}
+            mount_tomb $PARAM
             ;;
 
         # Close the tomb
@@ -2762,7 +2762,7 @@ main() {
 
         # Search tomb contents
         search)
-            search_tombs ${=PARAM}
+            search_tombs $PARAM
             ;;
 
         ## Locking operations
@@ -2771,7 +2771,7 @@ main() {
         engrave)
             [[ $QRENCODE == 0 ]] && {
                 _failure "QREncode not installed: cannot engrave keys on paper." }
-            engrave_key ${=PARAM}
+            engrave_key $PARAM
             ;;
 
         # Change password on existing key
@@ -2781,7 +2781,7 @@ main() {
 
         # Change tomb key
         setkey)
-            change_tomb_key ${=PARAM}
+            change_tomb_key $PARAM
             ;;
 
         # STEGANOGRAPHY: hide key inside an image