diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2025-12-17 18:43:57 -0500 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2025-12-17 18:43:57 -0500 |
| commit | 2ebc6e0e9e27f75fccfdb3b7baede6dc166859c2 (patch) | |
| tree | d77fcbdb77a78d87fc37613aa8277a6549a4a518 /dpw-age | |
| parent | 014c2ee5eb6b4ba8b16b2e81ac71b13ecf401081 (diff) | |
| download | dpw-2ebc6e0e9e27f75fccfdb3b7baede6dc166859c2.tar.gz dpw-2ebc6e0e9e27f75fccfdb3b7baede6dc166859c2.tar.xz | |
Add a sync function and ability to expose the configured backend through the dpw frontend
Diffstat (limited to 'dpw-age')
| -rwxr-xr-x | dpw-age | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2021 Mitchell Riedstra +# Copyright 2025 Mitchell Riedstra # # Permission to use, copy, modify, and/or distribute this software for any purpose # with or without fee is hereby granted, provided that the above copyright notice @@ -24,6 +24,8 @@ DPW_AGE_DIR="${DPW_AGE_DIR:-$HOME/.dpw-age}" DPW_AGE_KEY="${DPW_AGE_KEY:-$HOME/.dpw-age-key}" DPW_AGE_RECIPIENT_SUFFIX="${DPW_AGE_RECIPIENT_SUFFIX:-.recipients}" DPW_AGE_AUTO_SYNC="${DPW_AGE_AUTO_SYNC:-NO}" +DPW_AGE_BIN="${DPW_AGE_BIN:-age}" +age="$DPW_AGE_BIN" # No user overrides DPW_AGE_RECIPIENTS_FILE="" @@ -32,6 +34,7 @@ USE_GIT=0 # Helper functions + _git_commit() { [ $USE_GIT -eq 0 ] && return cd "${DPW_AGE_DIR}" @@ -97,7 +100,7 @@ sync() { show() { pth="$1"; shift #shellcheck disable=SC2086 -exec age -i "${DPW_AGE_KEY}" -d < "${DPW_AGE_DIR}/${pth}.age" +exec "$age" -i "${DPW_AGE_KEY}" -d < "${DPW_AGE_DIR}/${pth}.age" } @@ -106,7 +109,7 @@ pth="$1"; shift _set_age_recipients "$pth" mkdir -p "$DPW_AGE_DIR/$(dirname "$pth")" #shellcheck disable=SC2086 -age -R "$DPW_AGE_RECIPIENTS_FILE" -e \ +"$age" -R "$DPW_AGE_RECIPIENTS_FILE" -e \ > "${DPW_AGE_DIR}/${pth}.age" _git_commit "Insert: $pth" } @@ -226,9 +229,9 @@ grep -q YUBIKEY "${DPW_AGE_KEY}" \ && echo "Detected yubikey, you may need to tap it..." # Test the key and recipients before we get too far along tmpf="$(mktemp)" -echo "testing our key... works!" | age -R "${DPW_AGE_RECIPIENTS_FILE}" -e \ +echo "testing our key... works!" | "$age" -R "${DPW_AGE_RECIPIENTS_FILE}" -e \ > "$tmpf" -age -i "${DPW_AGE_KEY}" -d < "$tmpf" +"$age" -i "${DPW_AGE_KEY}" -d < "$tmpf" if [ $USE_GIT -eq 1 ] ; then git init |
