commit b7e89e52466a444a2e5c199217733f0bcf38e197 parent f06f303491c067afbfaa4a46551dbc861256d30c Author: Jaromil <jaromil@dyne.org> Date: Sun, 3 Aug 2014 19:54:43 +0200 fix to exhume key (steg) to correctly print on stdout when -k - addressing issue #118 Diffstat:
M | tomb | | | 23 | ++++++++++++++--------- |
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/tomb b/tomb @@ -942,7 +942,10 @@ bury_key() { } exhume_key() { tombkey="`option_value -k`" - { test "$tombkey" = "" } && { tombkey=stdout } + { test "$tombkey" = "" } && { + tombkey="-" + _message "printing exhumed key on stdout" + } imagefile="$1" res=1 @@ -952,14 +955,16 @@ exhume_key() { _failure "Encode failed: $imagefile is not a jpeg image." fi - if [[ -e "$tombkey" ]]; then - _warning "File exists: $tombkey" - { option_is_set -f } || { - _warning "Make explicit use of --force to overwrite." - _failure "Refusing to overwrite file. Operation aborted." } - _warning "Use of --force selected: overwriting." - rm -f ${tombkey} - fi + { test "$tombkey" = "-" } || { + if [[ -e "$tombkey" ]]; then + _warning "File exists: $tombkey" + { option_is_set -f } || { + _warning "Make explicit use of --force to overwrite." + _failure "Refusing to overwrite file. Operation aborted." } + _warning "Use of --force selected: overwriting." + rm -f ${tombkey} + fi + } _message "Trying to exhume a key out of image $imagefile" if option_is_set --tomb-pwd; then