47 lines
1.3 KiB
Bash
Executable File
47 lines
1.3 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"
|
|
|
|
dirs=("espanso", "forge", "ghostty", "kitty", "nvim", "tmux")
|
|
|
|
for dir in "${dirs[@]}"; do
|
|
echo "--- Setting up $dir ---"
|
|
|
|
# Remove old symlink if it exists
|
|
if [ -L "$CONFIG/$dir" ]; then
|
|
rm "$CONFIG/$dir"
|
|
echo "Removed old symlink at $CONFIG/$dir"
|
|
fi
|
|
|
|
# Backup existing directory if it exists
|
|
if [ -d "$CONFIG/$dir" ]; then
|
|
mv "$CONFIG/$dir" "$PANAMA_OLD/$dir"
|
|
echo "Moved existing $dir config to $PANAMA_OLD/$dir"
|
|
fi
|
|
|
|
# Create symlink
|
|
ln -s "$PANAMA_DOT/$dir" "$CONFIG/$dir"
|
|
echo "Linked $PANAMA_DOT/$dir → $CONFIG/$dir"
|
|
echo
|
|
done
|