Fixed init committing before .gpg-id created; muted calls to gpg
This commit is contained in:
18
vns
18
vns
@@ -77,14 +77,10 @@ vns_init () {
|
|||||||
echo -n '' > "${VNS_STORE}/.gpg-id"
|
echo -n '' > "${VNS_STORE}/.gpg-id"
|
||||||
|
|
||||||
vns_reencrypt "$VNS_STORE" "$@"
|
vns_reencrypt "$VNS_STORE" "$@"
|
||||||
|
|
||||||
else
|
else
|
||||||
# Create a new VNS Store
|
# Create a new VNS Store
|
||||||
git init "$VNS_STORE"
|
git init "$VNS_STORE" >/dev/null
|
||||||
|
vns_report "Initialized new VNS store"
|
||||||
# Make initial commit
|
|
||||||
vns_git add .gpg-id
|
|
||||||
vns_git commit -am "Initialized VNS Store"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -93,6 +89,8 @@ vns_init () {
|
|||||||
for recipient in "$@"; do
|
for recipient in "$@"; do
|
||||||
echo "$recipient" >> "${VNS_STORE}/.gpg-id"
|
echo "$recipient" >> "${VNS_STORE}/.gpg-id"
|
||||||
done
|
done
|
||||||
|
vns_git add .gpg-id >/dev/null
|
||||||
|
vns_git commit -am "Updated GPG recipients" >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
vns_reencrypt () {
|
vns_reencrypt () {
|
||||||
@@ -109,7 +107,7 @@ vns_reencrypt () {
|
|||||||
|
|
||||||
# Find all notes and re-encrypt them
|
# Find all notes and re-encrypt them
|
||||||
find "${VNS_STORE}" -name "*.gpg" | while read -r FILE; do\
|
find "${VNS_STORE}" -name "*.gpg" | while read -r FILE; do\
|
||||||
gpg --batch -d "$FILE" 2>/dev/null | gpg --batch "${GPG_RECIPS[@]}" -e -o "${FILE}_new".gpg >/dev/null 2>&1
|
gpg --batch --decrypt "$FILE" 2>/dev/null | gpg --batch "${GPG_RECIPS[@]}" --encrypt --output "${FILE}_new".gpg >/dev/null 2>&1
|
||||||
mv "${FILE}_new.gpg" "$FILE";
|
mv "${FILE}_new.gpg" "$FILE";
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -237,7 +235,7 @@ vns_create () {
|
|||||||
|
|
||||||
# Create empty note
|
# Create empty note
|
||||||
mkdir -p "$(dirname "$VNS_STORE/$1.gpg")"
|
mkdir -p "$(dirname "$VNS_STORE/$1.gpg")"
|
||||||
vns_header "$(basename "$1")" | gpg --batch "$(vns_gpgid)" --encrypt -o "$VNS_STORE/$1.gpg"
|
vns_header "$(basename "$1")" | gpg --batch "$(vns_gpgid)" --encrypt -o "$VNS_STORE/$1.gpg" 2>/dev/null
|
||||||
|
|
||||||
# Edit the note
|
# Edit the note
|
||||||
vim "$VNS_STORE/$1.gpg"
|
vim "$VNS_STORE/$1.gpg"
|
||||||
@@ -352,10 +350,6 @@ vns_merge () {
|
|||||||
if [ -r "$VNS_STORE/$1.gpg" ]; then vns_raise "Output file already exists." 82; fi
|
if [ -r "$VNS_STORE/$1.gpg" ]; then vns_raise "Output file already exists." 82; fi
|
||||||
if [ ! -r "$VNS_STORE/$2.gpg" ]; then vns_raise "Could not read $2" 83; fi
|
if [ ! -r "$VNS_STORE/$2.gpg" ]; then vns_raise "Could not read $2" 83; fi
|
||||||
|
|
||||||
#local GPG_OPTS=()
|
|
||||||
#for recip in $(gpg --list-only -v -d "${VNS_STORE}/$2.gpg" 2>&1 | awk '/public key is/{print $5}'); do
|
|
||||||
# GPG_OPTS=( "${GPG_OPTS[@]}" -r "$recip" )
|
|
||||||
#done
|
|
||||||
local -r NOTE_NAME="$1"
|
local -r NOTE_NAME="$1"
|
||||||
local -r OUTPUT="${VNS_STORE}/${1}.gpg"
|
local -r OUTPUT="${VNS_STORE}/${1}.gpg"
|
||||||
shift
|
shift
|
||||||
|
|||||||
Reference in New Issue
Block a user