Gitconfig user template autofill and automatic checkinstall

This commit is contained in:
lhark 2016-06-28 04:22:35 +02:00
parent 0056d9d11e
commit 99a687a315
5 changed files with 24 additions and 12 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
vim/.netrwhist
vim/bundle/*
git_user

4
git_user.def Normal file
View file

@ -0,0 +1,4 @@
[user]
name = {username}
email = {email}

View file

@ -1,8 +1,7 @@
[core]
excludesfile = ~/.gitignore_global
[user]
name = lhark
email = lhark@hotmail.fr
[include]
path = ~/.git_user
[master]
autosetuprebase = always
[color]

View file

@ -2,17 +2,23 @@
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
HOST=`hostname`
# List of the config files to install
FILES="vimrc zshrc gitconfig vim gitignore_global"
FILES="vimrc zshrc gitconfig vim gitignore_global git_user"
if [[ ! $1 == "--check" ]]
then
cp $SCRIPTPATH/git_user.def $SCRIPTPATH/git_user
sed -i -e "s/{username}/$USER/" $SCRIPTPATH/git_user
sed -i -e "s/{email}/$USER@$HOST/" $SCRIPTPATH/git_user
fi
# Create symbolic links in the user's home dir
cd $HOME
for file in $FILES
do
if [ ! -f .${file} ]
if [ ! -e $HOME/.${file} ]
then
ln -s ${SCRIPTPATH}/${file} .${file}
ln -s ${SCRIPTPATH}/${file} $HOME/.${file}
fi
done
cd -

10
zshrc
View file

@ -18,7 +18,7 @@ RC_PATH=$(dirname "$(readlink -f ${(%):-%x})")
# Mise à jour automatique à partir du repo distant
pushd > /dev/null 2>&1
PWD=`pwd`
cd $RC_PATH
# In case the network is down, don't lock the terminal
@ -37,13 +37,15 @@ elif $(echo "$git_st" | grep '^## .*behind' &> /dev/null); then
echo "Type Y to update .zshrc: \c"
read line
if [ "$line" = Y ] || [ "$line" = y ]; then
git pull --rebase --stat origin master && source $HOME/.zshrc
popd > /dev/null 2>&1
git pull --rebase --stat origin master
./install.sh --check
cd $PWD
source $HOME/.zshrc
return
fi
fi
popd > /dev/null 2>&1
cd $PWD
# Configuration for virtualenv