Fixed spaces handling in Tomb

This commit is contained in:
Arusekk 2017-02-05 20:29:22 +01:00
parent 1f852908ae
commit f4cdc1a0c5

24
tomb
View File

@ -242,9 +242,9 @@ _plot() {
TOMBFILE=$(basename $TOMBPATH) TOMBFILE=$(basename $TOMBPATH)
# The tomb name is TOMBFILE without an extension. # The tomb name is TOMBFILE without an extension and underscores instead of spaces (for mount and cryptsetup)
# It can start with dots: ..foo.tomb -> ..foo # It can start with dots: ..foo bar baz.tomb -> ..foo_bar_baz
TOMBNAME="${TOMBFILE%\.[^\.]*}" TOMBNAME=${${TOMBFILE// /_}%.*}
[[ -z $TOMBNAME ]] && { [[ -z $TOMBNAME ]] && {
_failure "Tomb won't work without a TOMBNAME." } _failure "Tomb won't work without a TOMBNAME." }
@ -1069,7 +1069,7 @@ ask_key_password() {
# call cryptsetup with arguments using the currently known secret # call cryptsetup with arguments using the currently known secret
# echo flags eliminate newline and disable escape (BSD_ECHO) # echo flags eliminate newline and disable escape (BSD_ECHO)
_cryptsetup() { _cryptsetup() {
print -R -n - "$TOMBSECRET" | _sudo cryptsetup --key-file - ${=@} print -R -n - "$TOMBSECRET" | _sudo cryptsetup --key-file - ${@}
return $? return $?
} }
@ -2304,7 +2304,7 @@ search_tombs() {
# Use swish-e to search over contents # Use swish-e to search over contents
[[ $SWISH == 1 && -r $tombmount/.swish ]] && { [[ $SWISH == 1 && -r $tombmount/.swish ]] && {
_message "Searching contents in tomb ::1 tomb name::" $tombname _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 "Skipping tomb ::1 tomb name::: not indexed." $tombname
_warning "Run 'tomb index' to create indexes." } _warning "Run 'tomb index' to create indexes." }
@ -2709,22 +2709,22 @@ main() {
# CREATE Step 1: dig -s NN file.tomb # CREATE Step 1: dig -s NN file.tomb
dig) dig)
dig_tomb ${=PARAM} dig_tomb $PARAM
;; ;;
# CREATE Step 2: forge file.tomb.key # CREATE Step 2: forge file.tomb.key
forge) forge)
forge_key ${=PARAM} forge_key $PARAM
;; ;;
# CREATE Step 2: lock -k file.tomb.key file.tomb # CREATE Step 2: lock -k file.tomb.key file.tomb
lock) lock)
lock_tomb_with_key ${=PARAM} lock_tomb_with_key $PARAM
;; ;;
# Open the tomb # Open the tomb
mount|open) mount|open)
mount_tomb ${=PARAM} mount_tomb $PARAM
;; ;;
# Close the tomb # Close the tomb
@ -2755,7 +2755,7 @@ main() {
# Search tomb contents # Search tomb contents
search) search)
search_tombs ${=PARAM} search_tombs $PARAM
;; ;;
## Locking operations ## Locking operations
@ -2764,7 +2764,7 @@ main() {
engrave) engrave)
[[ $QRENCODE == 0 ]] && { [[ $QRENCODE == 0 ]] && {
_failure "QREncode not installed: cannot engrave keys on paper." } _failure "QREncode not installed: cannot engrave keys on paper." }
engrave_key ${=PARAM} engrave_key $PARAM
;; ;;
# Change password on existing key # Change password on existing key
@ -2774,7 +2774,7 @@ main() {
# Change tomb key # Change tomb key
setkey) setkey)
change_tomb_key ${=PARAM} change_tomb_key $PARAM
;; ;;
# STEGANOGRAPHY: hide key inside an image # STEGANOGRAPHY: hide key inside an image