summaryrefslogtreecommitdiff
path: root/ssh-co-dotfiles
blob: e55e817a9882761fbfd98cb9904984d5c8c56f19 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/sh

set -e
set -u

if [ "$#" != 1 ]; then
	echo >&2 "Usage: $0 <hostname>"
	exit 1
fi

h="$1"
#echo "Expect svn cert fingerprint to be"
#echo " 66:ab:46:50:ce:21:a5:4a:36:8c:82:0e:77:81:34:d5:53:10:d0:99"
echo
ssh "$h" 'if ! [ -e .dotfiles ] || ( [ -e .dotfiles/.svn ] && mv .dotfiles .dotfiles-svn ); then
	rm -rf .dotfiles.new &&
	cat > .git2.palfrader.org.crt << EOF &&
-----BEGIN CERTIFICATE-----
MIIFDTCCAvWgAwIBAgIJAIsni+g4o/7PMA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
BAMMEmdpdDIucGFsZnJhZGVyLm9yZzAeFw0xNDExMjcxMzE5MzJaFw0yNDExMjQx
MzE5MzJaMB0xGzAZBgNVBAMMEmdpdDIucGFsZnJhZGVyLm9yZzCCAiIwDQYJKoZI
hvcNAQEBBQADggIPADCCAgoCggIBAOVU+Ui2WRW6G5iJuuNX8iwH/Gu/avD+sh6M
m5JCW2HQg+05MbFVYbl7qm8ztc54Gw2UX4ohCqIJxuqxJD0zREA7obINvLhaGzp6
aE4c+M0ho5QMJLdeMsgVR1esMy8bixGm4gZ4xR62aIU8tnyW8dBSuSXVjVi+a4qe
UJE+n/oSuxOty4I/sdH+t4WRD7dBg0qFowVhvTuBP8sQGyvUuTXuooPKydjDXdCX
2h2jxfMJnZ/Tu/MPttqh790BYDEjRSri3ZwtnksX8rH8t/fAgu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ewG/HslSSk12yZ1r9AUlpM8PZbPd9cUYR65X1V0cHyOfskxGhX
GNkMrry7av7b5DH4cCyKICLADrcp8avKRqOz3sl1ZluqpRjxSngK4M50v5ArVJJk
sXmB2EZXwPrgijgIFWpRTarioptI9NxNF4RtpAjH1dI1VtP9kybvYKSP+z3cniFL
4Q==
-----END CERTIFICATE-----
EOF
	git -c http.sslCAinfo="$HOME"/.git2.palfrader.org.crt -c http.sslCAPath="$HOME"/.nonexistent clone https://git2.palfrader.org/git/conf/dotfiles.git .dotfiles.new &&
	rm -f .git2.palfrader.org.crt &&
	mv .dotfiles.new .dotfiles &&
	cd .dotfiles &&
	git config --local --add http.sslCAinfo "$HOME"/.dotfiles/.certs/git2.palfrader.org.crt &&
	git config --local --add http.sslCAPath "$HOME"/.nonexistent &&
	./Link-Them &&
	echo "All done";
  elif [ -e .dotfiles/.git ]; then
	cat > .git2.palfrader.org.crt << EOF &&
-----BEGIN CERTIFICATE-----
MIIFDTCCAvWgAwIBAgIJAIsni+g4o/7PMA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
BAMMEmdpdDIucGFsZnJhZGVyLm9yZzAeFw0xNDExMjcxMzE5MzJaFw0yNDExMjQx
MzE5MzJaMB0xGzAZBgNVBAMMEmdpdDIucGFsZnJhZGVyLm9yZzCCAiIwDQYJKoZI
hvcNAQEBBQADggIPADCCAgoCggIBAOVU+Ui2WRW6G5iJuuNX8iwH/Gu/avD+sh6M
m5JCW2HQg+05MbFVYbl7qm8ztc54Gw2UX4ohCqIJxuqxJD0zREA7obINvLhaGzp6
aE4c+M0ho5QMJLdeMsgVR1esMy8bixGm4gZ4xR62aIU8tnyW8dBSuSXVjVi+a4qe
UJE+n/oSuxOty4I/sdH+t4WRD7dBg0qFowVhvTuBP8sQGyvUuTXuooPKydjDXdCX
2h2jxfMJnZ/Tu/MPttqh790BYDEjRSri3ZwtnksX8rH8t/fAguKk32M3uyZA88GH
19JNHa2T+ifKNoFtI0o6Q6+b/3c9iJ5v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
GNkMrry7av7b5DH4cCyKICLADrcp8avKRqOz3sl1ZluqpRjxSngK4M50v5ArVJJk
sXmB2EZXwPrgijgIFWpRTarioptI9NxNF4RtpAjH1dI1VtP9kybvYKSP+z3cniFL
4Q==
-----END CERTIFICATE-----
EOF
	rm -f .gitconfig &&
	cd .dotfiles &&
	git remote set-url origin https://git2.palfrader.org/git/conf/dotfiles.git &&
	git -c http.sslCAinfo="$HOME"/.git2.palfrader.org.crt -c http.sslCAPath="$HOME"/.nonexistent pull &&
	git config --local --add http.sslCAinfo "$HOME"/.dotfiles/.certs/git2.palfrader.org.crt &&
	git config --local --add http.sslCAPath "$HOME"/.nonexistent &&
	rm -f .git2.palfrader.org.crt &&
	./Link-Them &&
	echo "Pulled with current cert.";
	fi
	'