1 #!/bin/sh 2 3 repos_dir="/var/www/git" 4 5 while true; do 6 printf "new repository name: " 7 read -r repo_name; 8 repo_name=$(echo -n $repo_name | sed 's/ /-/g'): 9 10 case $repo_name in 11 *[\/\!\&\(\)\{\}\[\]@\#$%^*_+?]* ) \ 12 echo 'name containing invalid character' ;; 13 * ) break; 14 esac 15 done 16 17 echo "creating new repository: \"$repo_name\"" 18 19 mkdir -p "$repos_dir"/"$repo_name"/"$repo_name".git 20 21 ln -sf "$repos_dir"/"$repo_name"/"$repo_name".git /home/git 22 23 cp "$repos_dir"/dotfiles/dotfiles.git/hooks/post-receive