-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
#!/bin/bash | ||
|
||
local path="$1" | ||
local passfile="$PREFIX/$path.gpg" | ||
check_sneaky_paths "$path" | ||
|
||
if [[ -f $passfile ]]; then | ||
$GPG -d "${GPG_OPTS[@]}" "$passfile" | tail -n +2 || exit $? | ||
elif [[ -z $path ]]; then | ||
die "" | ||
else | ||
die "Error: $path is not in the password store." | ||
fi | ||
#!/bin/bash | ||
|
||
local path="$1" | ||
local passfile="$PREFIX/$path.gpg" | ||
check_sneaky_paths "$path" | ||
|
||
if [[ -f $passfile ]]; then | ||
$GPG -d "${GPG_OPTS[@]}" "$passfile" | tail -n +2 || exit $? | ||
elif [[ -z $path ]]; then | ||
die "" | ||
else | ||
die "Error: $path is not in the password store." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
#!/bin/bash | ||
|
||
[[ $# -ne 1 ]] && die "Usage: $PROGRAM $COMMAND pass-name" | ||
|
||
local path="${1%/}" | ||
check_sneaky_paths "$path" | ||
mkdir -p -v "$PREFIX/$(dirname "$path")" | ||
set_gpg_recipients "$(dirname "$path")" | ||
local passfile="$PREFIX/$path.gpg" | ||
|
||
tmpdir #Defines $SECURE_TMPDIR | ||
local tmp_file="$(mktemp -u "$SECURE_TMPDIR/XXXXXX")-${path//\//-}.txt" | ||
|
||
|
||
local action="Add" | ||
if [[ -f $passfile ]]; then | ||
$GPG -d "${GPG_OPTS[@]}" "$passfile" | tail -n +2 > "$tmp_file" || exit 1 | ||
action="Edit" | ||
fi | ||
${EDITOR:-vi} "$tmp_file" | ||
[[ -f $tmp_file ]] || die "New password not saved." | ||
$GPG -d -o - "${GPG_OPTS[@]}" "$passfile" 2>/dev/null | tail -n +2 | diff - "$tmp_file" &>/dev/null && die "Password unchanged." | ||
|
||
local tmp_file_joined="$(mktemp -u "$SECURE_TMPDIR/XXXXXX")-${path//\//-}.txt" | ||
|
||
$GPG -d "${GPG_OPTS[@]}" "$passfile" | head -n 1 > "$tmp_file_joined" | ||
cat "$tmp_file" >> "$tmp_file_joined" | ||
|
||
while ! $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}" "$tmp_file_joined"; do | ||
yesno "GPG encryption failed. Would you like to try again?" | ||
done | ||
git_add_file "$passfile" "$action password for $path using ${EDITOR:-vi}." | ||
#!/bin/bash | ||
|
||
[[ $# -ne 1 ]] && die "Usage: $PROGRAM $COMMAND pass-name" | ||
|
||
local path="${1%/}" | ||
check_sneaky_paths "$path" | ||
mkdir -p -v "$PREFIX/$(dirname "$path")" | ||
set_gpg_recipients "$(dirname "$path")" | ||
local passfile="$PREFIX/$path.gpg" | ||
|
||
tmpdir #Defines $SECURE_TMPDIR | ||
local tmp_file="$(mktemp -u "$SECURE_TMPDIR/XXXXXX")-${path//\//-}.txt" | ||
|
||
|
||
local action="Add" | ||
if [[ -f $passfile ]]; then | ||
$GPG -d "${GPG_OPTS[@]}" "$passfile" | tail -n +2 > "$tmp_file" || exit 1 | ||
action="Edit" | ||
fi | ||
${EDITOR:-vi} "$tmp_file" | ||
[[ -f $tmp_file ]] || die "New password not saved." | ||
$GPG -d -o - "${GPG_OPTS[@]}" "$passfile" 2>/dev/null | tail -n +2 | diff - "$tmp_file" &>/dev/null && die "Password unchanged." | ||
|
||
local tmp_file_joined="$(mktemp -u "$SECURE_TMPDIR/XXXXXX")-${path//\//-}.txt" | ||
|
||
$GPG -d "${GPG_OPTS[@]}" "$passfile" | head -n 1 > "$tmp_file_joined" | ||
cat "$tmp_file" >> "$tmp_file_joined" | ||
|
||
while ! $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}" "$tmp_file_joined"; do | ||
yesno "GPG encryption failed. Would you like to try again?" | ||
done | ||
git_add_file "$passfile" "$action password for $path using ${EDITOR:-vi}." |