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/.netrwhist
vim/bundle/* 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] [core]
excludesfile = ~/.gitignore_global excludesfile = ~/.gitignore_global
[user] [include]
name = lhark path = ~/.git_user
email = lhark@hotmail.fr
[master] [master]
autosetuprebase = always autosetuprebase = always
[color] [color]

View file

@ -2,17 +2,23 @@
SCRIPT=$(readlink -f "$0") SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTPATH=$(dirname "$SCRIPT")
HOST=`hostname`
# List of the config files to install # 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 # Create symbolic links in the user's home dir
cd $HOME
for file in $FILES for file in $FILES
do do
if [ ! -f .${file} ] if [ ! -e $HOME/.${file} ]
then then
ln -s ${SCRIPTPATH}/${file} .${file} ln -s ${SCRIPTPATH}/${file} $HOME/.${file}
fi fi
done done
cd -

10
zshrc
View file

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