48 lines
1.5 KiB
Bash
Executable File
48 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# A script to REMOVE old broken links and CREATE correct new ones.
|
|
|
|
set -e # Exit immediately if a command exits with a non-zero status.
|
|
|
|
DOTFILES_DIR="$HOME/dotfiles"
|
|
CONFIG_DIR="$HOME/.config"
|
|
|
|
# List of all config DIRECTORIES to be linked into ~/.config
|
|
CONFIG_DIRS=(
|
|
"atuin" "borg" "btop" "carapace" "gh" "ghostty"
|
|
"kitty" "lazygit" "nushell" "nvim" "zellij"
|
|
)
|
|
|
|
echo "--- Starting to fix symbolic links ---"
|
|
|
|
# --- 1. Fix links for directories inside ~/.config ---
|
|
for dir in "${CONFIG_DIRS[@]}"; do
|
|
SOURCE_PATH="$DOTFILES_DIR/$dir"
|
|
LINK_PATH="$CONFIG_DIR/$dir"
|
|
|
|
echo "-> Processing $dir..."
|
|
# Remove any existing file, directory, or broken link at the destination
|
|
rm -rf "$LINK_PATH"
|
|
# Create the new, correct symlink. -T prevents nesting.
|
|
ln -sT "$SOURCE_PATH" "$LINK_PATH"
|
|
echo " Linked $SOURCE_PATH -> $LINK_PATH"
|
|
done
|
|
|
|
# --- 2. Fix link for starship.toml file in ~/.config ---
|
|
SOURCE_PATH_STARSHIP="$DOTFILES_DIR/starship.toml"
|
|
LINK_PATH_STARSHIP="$CONFIG_DIR/starship.toml"
|
|
echo "-> Processing starship.toml..."
|
|
rm -f "$LINK_PATH_STARSHIP"
|
|
ln -sT "$SOURCE_PATH_STARSHIP" "$LINK_PATH_STARSHIP"
|
|
echo " Linked $SOURCE_PATH_STARSHIP -> $LINK_PATH_STARSHIP"
|
|
|
|
# --- 3. Fix link for .zshrc file in ~ ---
|
|
SOURCE_PATH_ZSHRC="$DOTFILES_DIR/.zshrc"
|
|
LINK_PATH_ZSHRC="$HOME/.zshrc"
|
|
echo "-> Processing .zshrc..."
|
|
rm -f "$LINK_PATH_ZSHRC"
|
|
ln -sT "$SOURCE_PATH_ZSHRC" "$LINK_PATH_ZSHRC"
|
|
echo " Linked $SOURCE_PATH_ZSHRC -> $LINK_PATH_ZSHRC"
|
|
|
|
echo "--- All links have been reset correctly. ---"
|