blob: e11212f9aa2dc446547ab3d89227561f83b5d3d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/bin/bash
set -euo pipefail
if [[ "$#" -gt 0 && ("$1" == "-h" || "$1" == "--help") ]]; then
cat <<EOF
ensure: Ensure the private key is configured and available
Verifies that the age private key is properly set up for secret operations.
If not configured, prompts the user to enter it.
Usage:
ensure
ensure -h|--help
The command will:
1. Check if the private key exists and is readable
2. If not found, prompt for manual entry
3. Validate the entered key against the public key
4. Store the private key in the appropriate location
Note: Interactive command that may prompt for user input.
EOF
exit 0
fi
this_dir="$(cd "$(dirname "$0")" && pwd)"
root_dir="$(cd "${this_dir}" && cd .. && pwd)"
source "${this_dir}/common.sh"
ensure_private_key
|