Git Repositories

Add some sanity checks to the git scripts to prevent root user to run it directly.
[simple-git-host.git] / homegit / makekeys.sh
1 #!/bin/sh
2 # vim: et ai cin sw=2 ts=2 tw=0:
3 [ "$HOME" = $(dirname $(readlink -f "$0")) ] || exit 255
4 cd ~/
5
6 if ! [ -d .ssh ]; then
7   mkdir .ssh
8   chmod go= .ssh
9 fi
10 cat /dev/null > .ssh/authorized_keys.tmp
11 for f in .keys/*.keys; do
12   u=$(basename $f .keys)
13   sed "s/^/command=\"check $u\" /" $f >> .ssh/authorized_keys.tmp
14 done
15 mv .ssh/authorized_keys.tmp .ssh/authorized_keys