Update install script for XDG_CONFIG_HOME compat
This commit is contained in:
parent
986afdcbff
commit
d607ee1976
1 changed files with 17 additions and 8 deletions
25
install.sh
25
install.sh
|
@ -1,30 +1,39 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
SCRIPT=$(readlink -f "$0")
|
SCRIPT=$(readlink -f "$0")
|
||||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
RC_PATH=$(dirname "$SCRIPT")
|
||||||
HOST=$(hostname)
|
HOST=$(hostname)
|
||||||
|
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
|
||||||
|
|
||||||
# List of the config files to install
|
# List of the config files to install
|
||||||
FILES="vimrc zshrc gitconfig vim gitignore_global git_user ctags.d"
|
FILES="vimrc zshrc gitconfig vim gitignore_global git_user ctags.d"
|
||||||
|
CONF_DIR="config"
|
||||||
|
|
||||||
if [ ! -e "$HOME/.git_user" ]; then
|
if [ ! -e "$HOME/.git_user" ]; then
|
||||||
cp "$SCRIPTPATH/git_user.def" "$SCRIPTPATH/git_user"
|
cp "$RC_PATH/git_user.def" "$RC_PATH/git_user"
|
||||||
sed -i -e "s/{username}/$USER/" "$SCRIPTPATH/git_user"
|
sed -i -e "s/{username}/$USER/" "$RC_PATH/git_user"
|
||||||
sed -i -e "s/{email}/$USER@$HOST/" "$SCRIPTPATH/git_user"
|
sed -i -e "s/{email}/$USER@$HOST/" "$RC_PATH/git_user"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Init or update submodules
|
# Init or update submodules
|
||||||
cd "$SCRIPTPATH"
|
cd "$RC_PATH"
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
cd -
|
cd - > /dev/null
|
||||||
|
|
||||||
# Setup fast-syntax-highlighting theme customization
|
# Setup fast-syntax-highlighting theme customization
|
||||||
cp "$SCRIPTPATH/fsh_theme.zsh" "$SCRIPTPATH/fast-syntax-highlighting/current_theme.zsh"
|
cp "$RC_PATH/fsh_theme.zsh" "$RC_PATH/fast-syntax-highlighting/current_theme.zsh"
|
||||||
|
|
||||||
# Create symbolic links in the user's home dir
|
# Create symbolic links in the user's home dir
|
||||||
for file in $FILES
|
for file in $FILES
|
||||||
do
|
do
|
||||||
if [ ! -e "$HOME/.${file}" ]; then
|
if [ ! -e "$HOME/.${file}" ]; then
|
||||||
ln -s "${SCRIPTPATH}/${file}" "$HOME/.${file}"
|
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."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
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.\")" \;
|
||||||
|
|
Loading…
Reference in a new issue