Git Repositories

Add some sanity checks to the git scripts to prevent root user to run it directly.
authorCyrille Pontvieux <jrd@enialis.net>
Sun, 21 Jul 2013 15:44:51 +0000 (17:44 +0200)
committerCyrille Pontvieux <jrd@enialis.net>
Sun, 21 Jul 2013 15:44:51 +0000 (17:44 +0200)
homegit/gitrepo.sh
homegit/makekeys.sh

index fd7e4b3..920a045 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/sh
 # vim: et ai cin sw=2 ts=2 tw=0:
+[ "$HOME" = $(dirname $(readlink -f "$0")) ] || exit 255
 cd ~/
 
 usage() {
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)