git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/bin/ssh-agent-launcher
blob: 0d116dc944188cf765b4b7fc3b29bbe7b2e1d0e4 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash

if [ -z "$SSHENVFILE" ];then
	printf "SSHENVFILE not set, no target for SSH environment variables.\\n" >&2
	exit 1
fi

VERB=1
KILLIT=0
while getopts ":qf" SHOPT;do
	case "$SHOPT" in
		q) VERB=0;;
		f) KILLIT=1;;
		*) printf "WAT\n" >&2;exit 127;;
	esac
done
shift "$(( OPTIND -1 ))"

[ "$VERB" -eq 1 ]&&printf "[....] Starting SSH agent.\\033[s"
ROEDGROED="$(pgrep -U "$(whoami)" ssh-agent|grep -v grep|awk '{print $1}')"

if [ -n "$ROEDGROED" ];then
	if [ "$KILLIT" -eq 1 ];then
		for i in $(echo "$ROEDGROED");do kill "$i" >/dev/null 2>&1||break;done
		case "$?" in
			0);;
			*)
				[ "$VERB" -eq 1 ]&&printf "\\033[666D[\\033[31mFAIL\\033[0m]\\033[u\\033[K\\n"
				exit 2
			;;
		esac
	else
		[ "$VERB" -eq 1 ]&&printf "\\033[666D[\\033[30;1mSKIP\\033[0m]\\033[u\\033[K (running, PID: %s)\\n" "$ROEDGROED"
		exit 0
	fi
fi
ssh-agent >"$SSHENVFILE" 2>&1&&chmod 0600 "$SSHENVFILE" >/dev/null 2>&1
case "$?" in
	0)
		sed -i 's/^echo[^\;]*\;//g' "$SSHENVFILE" >/dev/null 2>&1
		[ "$VERB" -eq 1 ]&&printf "\\033[666D[\\033[32m OK \\033[0m]\\033[u\\033[K\\n"
		exit 0
	;;
	*)
		[ "$VERB" -eq 1 ]&&printf "\\033[666D[\\033[31mFAIL\\033[0m]\\033[u\\033[K\\n"
		exit 1
	;;
esac
00 here goes another attempt commit cbc3482c5d475eff579902004f81cefd38cfcb98 Author: Harald Pfeiffer <coding@lirion.de> Date: Sun Jul 14 10:53:38 2024 +0200 specify branch of submodule commit 95a8483b04efddab37aa92d52134a823ecc1920f Merge: 5155ed2 ce9a713 Author: Harald Pfeiffer <coding@lirion.de> Date: Sun Jul 14 10:52:21 2024 +0200 Merge between two machines (again) commit 5155ed2eefa29fc2d660823f8609e0c7dcc85113 Author: Harald Pfeiffer <coding@lirion.de> Date: Sun Jul 14 10:52:12 2024 +0200 reintroducing main submodule shllow/sparse config commit ce9a713662fdb8cc30eed9bdfb3a9fc9ab217afc Merge: b2b8209 717e60b Author: Harald Pfeiffer <coding@lirion.de> Date: Sun Jul 14 10:38:11 2024 +0200 Merge between two pulls and machines commit b2b82097d4e167b285abac53d0e6a291a4f798a7 Author: Harald Pfeiffer <coding@lirion.de> Date: Sun Jul 14 10:38:03 2024 +0200 +weird sha1collisiondetection submodule in README commit 717e60be83f2cf22808bc75ba37459e888a39513 Author: Harald Pfeiffer <coding@lirion.de> Date: Sun Jul 14 10:29:35 2024 +0200 working commit for submodule commit 11376154555ea0a325742d0d81dc282642837940 Author: Harald Pfeiffer <coding@lirion.de> Date: Sun Jul 14 10:18:41 2024 +0200 revamp commit aaf11ee32d35a194eb58387f4742cf00acadbbf2 Author: Harald Pfeiffer <coding@lirion.de> Date: Sun Jul 14 10:08:07 2024 +0200 fix: submodule info of git-prompt was garbage commit 8faef2071a0dd0358714b082738dbc253378214a Author: Harald Pfeiffer <coding@lirion.de> Date: Sun Jul 14 09:59:33 2024 +0200 inclusion of git prompt commit 9b850221308f64fe6e641555fcbd24ddf5a7ff7b Author: Harald Pfeiffer <coding@lirion.de> Date: Sun Jul 14 09:00:08 2024 +0200 integrate go binaries in $HOME into PATH commit 71b39d46de0bfe14b44f4241c8b8af01d3fb6b27 Author: Harald Pfeiffer <coding@lirion.de> Date: Sun May 26 10:52:50 2024 +0200 Updated submodules commit 37fdb2a700e47cc84f0dd3b004b33c41b1eb4abe Author: Harald Pfeiffer <coding@lirion.de> Date: Sun May 26 10:48:44 2024 +0200 + flake8's cognitive complexity commit 6922aa0ab8cfbdc83fc2a38fe486c9a390807c99 Author: Harald Pfeiffer <coding@lirion.de> Date: Sat May 25 13:27:52 2024 +0200 include tofu in gpg trust model commit e5abe8e6672cff7852c48f1db57176d9b03538f9 Author: Harald Pfeiffer <coding@lirion.de> Date: Sat May 25 13:27:15 2024 +0200 fwiw, return to whitespaces. more bytes, but more interoperability. commit d9b65ed059e81cca89bcec21545aa8816198537d Author: Harald Pfeiffer <coding@lirion.de> Date: Sat May 25 13:25:35 2024 +0200 only use the control master if desired. causes more fuss than solutions on daily use. commit badff375848d9af77e9761619f374278da862dac Author: Harald Pfeiffer <coding@lirion.de> Date: Sat May 25 13:24:03 2024 +0200 + credential helper, + memory window * | easygit, lul.H. P. 2024-07-141-1/+1 | | * | solution in readmeH. P. 2024-07-141-20/+8 | | * | final hookH. P. 2024-07-141-16/+8 | | * | accidentH. P. 2024-07-141-1/+1 | | * | preparation for submodule-less checkoutH. P. 2024-07-143-12/+23 | | * | +pre-commitH. P. 2024-07-141-0/+4 | | * | add git-prompt to ignore listH. P. 2024-07-141-1/+1 | | * | remove from cacheH. P. 2024-07-141-0/+0 | | * | move submodule git-prompt to post-checkoutH. P. 2024-07-144-6/+14 | | * | ...H. P. 2024-07-141-1/+1 | | * | here goes another attemptH. P. 2024-07-142-1/+29 | | * | specify branch of submoduleH. P. 2024-07-141-0/+1 | | * | Merge between two machines (again)H. P. 2024-07-141-6/+11 |\ \ | * \ Merge between two pulls and machinesH. P. 2024-07-142-0/+3 | |\ \ | * | | +weird sha1collisiondetection submodule in READMEH. P. 2024-07-141-6/+11 | | | | * | | | reintroducing main submodule shllow/sparse configH. P. 2024-07-141-0/+2 | |/ / |/| | * | | working commit for submoduleH. P. 2024-07-142-0/+3 |/ / * | revamp