Skip to content

Commit

Permalink
fixed issues #3 and #10
Browse files Browse the repository at this point in the history
  • Loading branch information
davinerd committed Jul 26, 2011
1 parent b18ef6c commit 4125d58
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/tomb
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,17 @@ create_tomb() {
exit 1
fi

local tombkey="${tombdir}/${tombname}.tomb.key"
local rnd=$RANDOM
if [ -e "${tomkey}" ]; then
notice "Key file ${tombkey} already exists!"
notice "Renaming to ${tombdir}/${tombname}.tomb.$rnd.key"
tombkey="${tombdir}/${tombname}.tomb.$rnd.key"
fi

print "${tombpass}" | gpg \
--openpgp --batch --no-options --no-tty --passphrase-fd 0 2>/dev/null \
-o "${tombdir}/${tombname}.tomb.key" -c -a ${keytmp}/tomb.tmp
-o "${tombkey}" -c -a ${keytmp}/tomb.tmp

# if [ $? != 0 ]; then
# error "setting password failed: gnupg returns 2"
Expand Down Expand Up @@ -1071,7 +1078,12 @@ main () {
print "[D] Tomb invoked with args \"${(f)@}\" "
print "[D] running on `date`"
DEBUG=1; shift 1 ;;
-s) SIZE=$2; shift 2 ;;
-s) test=`awk '/^[0-9]+$/' <<< "$2"`
if [ -z "$test" ]; then
error "Size value must be a number!"
return 1
fi
SIZE=$2; shift 2 ;;
-k) KEY=$2; shift 2 ;;
-n) NOBIND=1; shift 1 ;;
-o) MOUNTOPTS=$2; shift 2;;
Expand Down

1 comment on commit 4125d58

@jaromil
Copy link
Member

@jaromil jaromil commented on 4125d58 Aug 4, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo on line 409: s/tomkey/tombkey/

Please sign in to comment.