35 lines
920 B
Bash
Executable File
35 lines
920 B
Bash
Executable File
#!/bin/bash
|
|
|
|
echo "***** INSTALL SYMLINKS *****"
|
|
|
|
ROOTDIR=$(cd "$(dirname "$0")/.." && pwd)
|
|
|
|
backup_existing() {
|
|
if [ -e "$1" ]; then
|
|
if [ ! -L "$1" ]; then
|
|
mv -v "$1" "$1.backup"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
# Backup configs that are not already symlinked
|
|
backup_existing "$HOME/.bashrc"
|
|
backup_existing "$HOME/.config/fish"
|
|
backup_existing "$HOME/.config/git"
|
|
backup_existing "$HOME/.config/nix"
|
|
backup_existing "$HOME/.config/nvim"
|
|
backup_existing "$HOME/.config/sbt"
|
|
|
|
# Create config directory if not present
|
|
mkdir -p "$HOME/.config"
|
|
|
|
# Create symlinks, forcing updates
|
|
ln -fnsv "$ROOTDIR/bash/.bashrc" "$HOME/.bashrc" # Bash does not support XDG config
|
|
ln -fnsv "$ROOTDIR/fish" "$HOME/.config/fish"
|
|
ln -fnsv "$ROOTDIR/git" "$HOME/.config/git"
|
|
ln -fnsv "$ROOTDIR/nix" "$HOME/.config/nix"
|
|
ln -fnsv "$ROOTDIR/nvim" "$HOME/.config/nvim"
|
|
ln -fnsv "$ROOTDIR/sbt" "$HOME/.config/sbt"
|
|
|
|
echo
|