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
index 04aca35..8af6dc1 100755 (executable)
@@ -1,7 +1,12 @@
 #!/bin/sh
 # vim: et ai cin sw=2 ts=2 tw=0:
+[ "$HOME" = $(dirname $(readlink -f "$0")) ] || exit 255
 cd ~/
 
+if ! [ -d .ssh ]; then
+  mkdir .ssh
+  chmod go= .ssh
+fi
 cat /dev/null > .ssh/authorized_keys.tmp
 for f in .keys/*.keys; do
   u=$(basename $f .keys)