27 lines
676 B
Bash
Executable File
27 lines
676 B
Bash
Executable File
#!/bin/sh
|
|
|
|
DOTFILES="$HOME/dotfiles"
|
|
|
|
backup_existing() {
|
|
if [ -e "$1" ]; then
|
|
if [ ! -L "$1" ]; then
|
|
mv -v "$1" "$1.backup"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
# Create required directories before making links
|
|
mkdir -p "$HOME/.config"
|
|
|
|
# Backup configs that are not already symlinked
|
|
backup_existing "$HOME/.bashrc"
|
|
backup_existing "$HOME/.config/fish"
|
|
backup_existing "$HOME/.config/nvim"
|
|
backup_existing "$HOME/.config/git"
|
|
|
|
# Create symlinks, forcing updates
|
|
ln -fsv "$DOTFILES/bash/.bashrc" "$HOME/.bashrc" # Bash does not support XDG config
|
|
ln -fsv "$DOTFILES/fish" "$HOME/.config"
|
|
ln -fsv "$DOTFILES/nvim" "$HOME/.config"
|
|
ln -fsv "$DOTFILES/git" "$HOME/.config"
|