diff options
| author | Arpit Chakladar <arpitchakladar@gmail.com> | 2026-09-24 04:19:59 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar@gmail.com> | 2026-09-24 04:19:59 +0530 |
| commit | 3a6e45ad18c519b21c9cadb2d374148647886b05 (patch) | |
| tree | c8ad94d5be285a770a319e6a6a6fdda6021b652a /modules/security/ssh | |
| parent | 574b4e4651495ed3fb14ef53a00374782d45b378 (diff) | |
| download | home-manager-config-3a6e45ad18c519b21c9cadb2d374148647886b05.tar.gz home-manager-config-3a6e45ad18c519b21c9cadb2d374148647886b05.zip | |
refactor: ran newly configured formatter for the whole project
Diffstat (limited to 'modules/security/ssh')
| -rw-r--r-- | modules/security/ssh/gpg-ssh-key-load.sh | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/modules/security/ssh/gpg-ssh-key-load.sh b/modules/security/ssh/gpg-ssh-key-load.sh index 02dda1d..b9567f8 100644 --- a/modules/security/ssh/gpg-ssh-key-load.sh +++ b/modules/security/ssh/gpg-ssh-key-load.sh @@ -15,10 +15,13 @@ export GNUPGHOME="@@GNUPGHOME@@" GOPASS_SSH_KEY="@@GOPASS_SSH_KEY@@" -info() { printf '\033[1;34m==>\033[0m %s\n' "$*"; } -warn() { printf '\033[1;33m==> warning:\033[0m %s\n' "$*" >&2; } +info() { printf '\033[1;34m==>\033[0m %s\n' "$*"; } +warn() { printf '\033[1;33m==> warning:\033[0m %s\n' "$*" >&2; } error() { printf '\033[1;31m==> error:\033[0m %s\n' "$*" >&2; } -die() { error "$*"; exit 1; } +die() { + error "$*" + exit 1 +} usage() { cat <<EOF @@ -34,15 +37,15 @@ EOF while [[ $# -gt 0 ]]; do case "$1" in - --help | -h) - usage - exit 0 - ;; - *) - error "Unknown option: $1" - usage - exit 1 - ;; + --help | -h) + usage + exit 0 + ;; + *) + error "Unknown option: $1" + usage + exit 1 + ;; esac done @@ -60,14 +63,14 @@ if ssh-add -l 2>/dev/null | grep -qE "(ED25519|RSA|ECDSA)"; then exit 0 fi -if ! gopass show -o "$GOPASS_SSH_KEY" > /dev/null 2>&1; then +if ! gopass show -o "$GOPASS_SSH_KEY" >/dev/null 2>&1; then die "no gopass entry $GOPASS_SSH_KEY" fi tmpdir=$(mktemp -d) trap 'rm -rf "$tmpdir"' EXIT keyfile="$tmpdir/key" -gopass show -o "$GOPASS_SSH_KEY" > "$keyfile" 2>/dev/null +gopass show -o "$GOPASS_SSH_KEY" >"$keyfile" 2>/dev/null chmod 600 "$keyfile" passphrase=$(gopass show -o "$GOPASS_SSH_KEY/passphrase" 2>/dev/null || true) @@ -82,4 +85,4 @@ if ! timeout 60 ssh-add "$keyfile"; then exit 1 fi -info "SSH key loaded into gpg-agent."
\ No newline at end of file +info "SSH key loaded into gpg-agent." |
