git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/bin/ssh-with-gpg
blob: 072930a85055406111d03068256e57bf2b10b838 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash

# THIS IS A DRAFT FOR TESTING. IF YOU WANT TO USE THIS, REMOVE OR COMMENT THE
# FOLLOWING LINE:
exit 0

if [ -z "$1" ];then
	printf "USAGE: %b TARGET [OPTIONS...]\\n" "$(basename "$0")" >&2
	exit 1
fi

TGT="$1"

REMUID="$(ssh "$TGT" "id -u")"
if [ -z "$REMUID" ];then
	printf "Cannot fetch user id from %b.\\n" "$TGT" >&2
	exit 2
fi

ssh -R "/run/user/$(id -u)/gnupg/S.dirmngr":"/run/user/${REMUID}/gnupg/S.dirmngr" -o "StreamLocalBindUnlink=yes" "$TGT" "${ _æ_ :2}"