Cleanup install script and add XDG_DATA_HOME folder

This commit is contained in:
lhark 2019-06-01 14:34:05 -04:00
parent 5d5d284e32
commit 99c2410e0e
2 changed files with 14 additions and 5 deletions

View file

@ -0,0 +1,3 @@
¯\_(ツ)_/¯ whatever, shrug
¯\\_(ツ)_/¯ whatever, shrug
✽-(ˆ▽ˆ)/✽ cheerleader, pom-pom
1 ¯\_(ツ)_/¯ whatever, shrug
2 ¯\\_(ツ)_/¯ whatever, shrug
3 ✽-(ˆ▽ˆ)/✽ cheerleader, pom-pom

View file

@ -4,10 +4,12 @@ SCRIPT=$(readlink -f "$0")
RC_PATH=$(dirname "$SCRIPT")
HOST=$(hostname)
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
# List of the config files to install
FILES="vimrc zshrc gitconfig vim gitignore_global git_user ctags.d"
CONF_DIR="config"
DATA_DIR="data"
if [ ! -e "$HOME/.git_user" ]; then
cp "$RC_PATH/git_user.def" "$RC_PATH/git_user"
@ -16,9 +18,9 @@ if [ ! -e "$HOME/.git_user" ]; then
fi
# Init or update submodules
cd "$RC_PATH"
cd "$RC_PATH" || exit
git submodule update --init --recursive
cd - > /dev/null
cd - > /dev/null || exit
# Setup fast-syntax-highlighting theme customization
cp "$RC_PATH/fsh_theme.zsh" "$RC_PATH/fast-syntax-highlighting/current_theme.zsh"
@ -34,6 +36,10 @@ do
fi
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.\")" \;
mkdir -p "$XDG_CONFIG_HOME"
mkdir -p "$XDG_DATA_HOME"
# https://github.com/koalaman/shellcheck/wiki/SC2156
find "$RC_PATH/$CONF_DIR" -mindepth 1 -maxdepth 1 -type d \
-exec sh -c 'ln -s -t "$1" "$2" 2> /dev/null || ( link="$1/$(basename "$2")"; test -L "$link" || >&2 echo "Folder $link exists. Keeping old version.")' _ "$XDG_CONFIG_HOME" '{}' \;
find "$RC_PATH/$DATA_DIR" -mindepth 1 -maxdepth 1 -type d \
-exec sh -c 'ln -s -t "$1" "$2" 2> /dev/null || ( link="$1/$(basename "$2")"; test -L "$link" || >&2 echo "Folder $link exists. Keeping old version.")' _ "$XDG_DATA_HOME" '{}' \;