diff --git a/bin/startRuby b/bin/startRuby index 06abcbe..1c2d1b7 100755 --- a/bin/startRuby +++ b/bin/startRuby @@ -19,25 +19,32 @@ ssh -F /usr/koeki/etc/gbrepo/.ssh/config "$@" } start() { - if [ ! -s $HOME/.gitconfig ]; then - if ! grep -q user.email $HOME/.gitconfig; then - if [ -s $HOME/.email ]; then - email=`grep -v '^#' $HOME/.email|head -1` - else - email=$user@$edom - fi - getent passwd `logname` | if IFS=: read u p uid gid gecos rest; then - git config --global user.name "$gecos" - git config --global user.email "$email" - fi + if ! grep -q "email.*$USER" $HOME/.gitconfig; then + if [ -s $HOME/.email ]; then + email=`grep -v '^#' $HOME/.email|head -1` + else + email=$USER@$edom + fi + getent passwd `logname` | if IFS=: read u p uid gid gecos rest; then + git config --global user.name "$gecos" + git config --global user.email "$email" fi fi if [ -d $HOME/Ruby/.git ]; then git -C $HOME/Ruby pull exit $? + elif [ -d $HOME/Ruby ]; then + td=`mktemp -d -t startRuby` + if [ -n "$td" -a -w "$td" ]; then + trap "rm -rf "$td"" INT HUP EXIT TERM + (cd "$td" + git clone "$repo" && rsync -axH Ruby $HOME + ) + fi + else + git clone $repo fi - git clone $repo (cd $HOME/Ruby git config pull.rebase true git config --add merge.ff false