summaryrefslogtreecommitdiff
path: root/Link-Them
blob: dbfa7e6dcc24bfaee1d858884e8d6d43318554ce (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
#!/bin/sh

set -e

cd "`dirname $0`"

DATE="`date +'%Y%m%d'`"
DIR="`pwd`"

for file in bash_profile bashrc screenrc vimrc zshrc; do
	if ! [ -L "$HOME/.$file" ]; then
		[ -e "$HOME/.$file" ] && mv "$HOME/.$file" "$HOME/.$file-$DATE"
		ln -s "$DIR/$file" "$HOME/.$file"
	fi
done

if ! [ -e "$HOME/.ssh/authorized_keys" ]; then
	gpg --keyserver keyserver.noreply.org --recv 94C09C7F
	if ! gpg --status-fd=1 --verify ssh/authorized_keys.asc | grep '\[GNUPG:\] VALIDSIG C5DED518FD5A040B3EE9615FCFF71CB3AFA44BDD'; then
		echo "ssh authorized keys failed verification" >&2
		exit 1
	fi
	umask 077
	[ -d "$HOME/.ssh" ] || mkdir "$HOME/.ssh"
	cp ssh/authorized_keys $HOME/.ssh
fi