Progress. I can now create and edit notes reliably.

This commit is contained in:
Jon-William Lewis
2016-01-25 19:33:48 -06:00
parent 6a21731082
commit 8fc731aaa0
8 changed files with 55 additions and 43 deletions

View File

@@ -10,9 +10,9 @@ function create(){
echo "TITLE: $NAME" > "$NOTE"
echo "DATE: $(date)" >> "$NOTE"
elif [ "$ENCRYPTION" == "TRUE" ]; then
touch "$NOTE"
p_header | openssl enc -aes-256-cbc -salt -out "$NOTE"\
-pass pass:"$ENC_KEY"
TARGET="$TMP_DIR"/"$SESSION_ID"
p_header > "$TARGET"
encrypt
fi
if [ -e "$NOTE" ]; then

View File

@@ -4,7 +4,9 @@ if [ ! -r "$NOTE" ]; then
exit 40;
fi
if [ "$ENCRYPTION" == "TRUE" ]; then decrypt
if [ "$ENCRYPTION" == "TRUE" ]; then
cp "$NOTE" "$NOTE".bk
decrypt
else TARGET="$NOTE"; fi
@@ -12,7 +14,11 @@ if [ -z "$CREATE" ]; then printf "\nEDIT %s" "$(date)" >> "$TARGET"; fi
"$EDITOR" "$TARGET"
if [ "$ENCRYPTION" == "TRUE" ]; then encrypt; fi
if [ "$ENCRYPTION" == "TRUE" ]; then
rm "$NOTE"
encrypt;
if [ -r "$NOTE" ]; then rm "$NOTE".bk; fi
fi

View File

@@ -3,7 +3,7 @@ function encrypt(){
# output file, "$NOTE", will encrypt $TARGET to $NOTE against $PUBKEY's private
# GPG key.
gpg -r "$PUBKEY" --encrypt-files "$TARGET" --output "$NOTE"
gpg -r "$PUBKEY" -o "$NOTE" -e "$TARGET"
}