36 lines
1.1 KiB
Bash
Executable File
36 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Define paths as they have not been defined by new bashrc yet!
|
|
PANAMA_PATH="${PANAMA_PATH:-$HOME/.local/share/Panama}"
|
|
PANAMA_BASH="${PANAMA_BASH:-$PANAMA_PATH/config/bash}"
|
|
PANAMA_DOT="$PANAMA_PATH/config/dot"
|
|
PANAMA_OLD="$PANAMA_PATH/config/old"
|
|
CONFIG="$HOME/.config"
|
|
|
|
# Make backup folder if it doesn't exist
|
|
mkdir -p "$PANAMA_OLD"
|
|
|
|
# --- Bashrc ---
|
|
# Backup existing .bashrc if it's a regular file
|
|
if [ -f "$HOME/.bashrc" ] && [ ! -L "$HOME/.bashrc" ]; then
|
|
mv "$HOME/.bashrc" "$PANAMA_OLD/.bashrc"
|
|
fi
|
|
# Remove old symlink if it exists and points somewhere else
|
|
if [ -L "$HOME/.bashrc" ]; then
|
|
rm "$HOME/.bashrc"
|
|
fi
|
|
# Symlink Panama .bashrc file to ~/.bashrc
|
|
ln -s "$PANAMA_BASH/.bashrc" "$HOME/.bashrc"
|
|
|
|
# --- Neovim ---
|
|
# Backup existing Neovim config if it's a regular directory
|
|
if [ -d "$CONFIG/nvim" ] && [ ! -L "$CONFIG/nvim"]; then
|
|
mv "$CONFIG/nvim" "$PANAMA_OLD/nvim"
|
|
fi
|
|
# Remove old symlink if it exists & points to somewhere else
|
|
if [ -L "$CONFIG/nvim" ]; then
|
|
rm "$CONFIG/nvim"
|
|
fi
|
|
# Symlink Panama nvim directory to ~/.config/nvim
|
|
ln -s "$PANAMA_DOT/nvim" "$CONFIG/nvim"
|