2016-10-22 05:10:25 +00:00
|
|
|
#!/bin/sh
|
2015-06-03 21:39:41 +00:00
|
|
|
|
|
|
|
SCRIPT=$(readlink -f "$0")
|
2019-02-21 05:30:04 +00:00
|
|
|
RC_PATH=$(dirname "$SCRIPT")
|
2016-10-22 05:10:25 +00:00
|
|
|
HOST=$(hostname)
|
2019-02-21 05:30:04 +00:00
|
|
|
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
|
2015-06-03 21:39:41 +00:00
|
|
|
|
2015-06-06 22:47:56 +00:00
|
|
|
# List of the config files to install
|
2018-11-22 20:09:32 +00:00
|
|
|
FILES="vimrc zshrc gitconfig vim gitignore_global git_user ctags.d"
|
2019-02-21 05:30:04 +00:00
|
|
|
CONF_DIR="config"
|
2016-06-28 02:22:35 +00:00
|
|
|
|
2016-10-22 05:10:25 +00:00
|
|
|
if [ ! -e "$HOME/.git_user" ]; then
|
2019-02-21 05:30:04 +00:00
|
|
|
cp "$RC_PATH/git_user.def" "$RC_PATH/git_user"
|
|
|
|
sed -i -e "s/{username}/$USER/" "$RC_PATH/git_user"
|
|
|
|
sed -i -e "s/{email}/$USER@$HOST/" "$RC_PATH/git_user"
|
2016-06-28 02:22:35 +00:00
|
|
|
fi
|
2015-06-03 21:39:41 +00:00
|
|
|
|
2018-07-19 19:07:18 +00:00
|
|
|
# Init or update submodules
|
2019-02-21 05:30:04 +00:00
|
|
|
cd "$RC_PATH"
|
2018-07-19 19:07:18 +00:00
|
|
|
git submodule update --init --recursive
|
2019-02-21 05:30:04 +00:00
|
|
|
cd - > /dev/null
|
2018-07-19 19:07:18 +00:00
|
|
|
|
2018-07-20 01:09:03 +00:00
|
|
|
# Setup fast-syntax-highlighting theme customization
|
2019-02-21 05:30:04 +00:00
|
|
|
cp "$RC_PATH/fsh_theme.zsh" "$RC_PATH/fast-syntax-highlighting/current_theme.zsh"
|
2018-07-20 01:09:03 +00:00
|
|
|
|
2015-06-06 22:47:56 +00:00
|
|
|
# Create symbolic links in the user's home dir
|
2015-06-03 21:45:41 +00:00
|
|
|
for file in $FILES
|
|
|
|
do
|
2016-10-22 05:10:25 +00:00
|
|
|
if [ ! -e "$HOME/.${file}" ]; then
|
2019-02-21 05:30:04 +00:00
|
|
|
ln -s "${RC_PATH}/${file}" "$HOME/.${file}"
|
|
|
|
# Only warn if an actual file exist, else we suppose it is from a previous install
|
|
|
|
elif [ ! -L "$HOME/.$file" ]; then
|
|
|
|
>&2 echo "File $HOME/.$file exists. Keeping old version."
|
2015-12-12 21:46:20 +00:00
|
|
|
fi
|
2015-06-03 21:39:41 +00:00
|
|
|
done
|
2019-02-21 05:30:04 +00:00
|
|
|
|
|
|
|
mkdir -p $XDG_CONFIG_HOME
|
|
|
|
find $RC_PATH/$CONF_DIR -mindepth 1 -maxdepth 1 -type d \
|
|
|
|
-exec sh -c "ln -s -t \"$XDG_CONFIG_HOME\" \"{}\" 2> /dev/null || ( link=$XDG_CONFIG_HOME/"'$(basename "{}")'"; test -L "'$link'" || >&2 echo \"Folder "'$link'" exists. Keeping old version.\")" \;
|