47 lines
1.5 KiB
Bash
Executable File
47 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Installs config files from this repo by creating symlinks.
|
|
# On first run, backs up originals to ~/.orig-config.
|
|
#
|
|
|
|
REPO_DIR="$HOME/jbashrc"
|
|
|
|
# The list of config files: "repo-relative-path:absolute-target"
|
|
FILES=(
|
|
"bash/dot-bashrc:$HOME/.bashrc"
|
|
"bash/dot-profile:$HOME/.profile"
|
|
"claude/CLAUDE.md:$HOME/.claude/CLAUDE.md"
|
|
"claude/settings.json:$HOME/.claude/settings.json"
|
|
"claude/integration-MEMORY.md:$HOME/.claude/projects/-home-jyelon-integration/memory/MEMORY.md"
|
|
"emacs/dot-emacs:$HOME/.emacs"
|
|
"git/dot-gitconfig:$HOME/.gitconfig"
|
|
"vscode/chatLanguageModels.json:$HOME/.config/Code/User/chatLanguageModels.json"
|
|
"vscode/keybindings.json:$HOME/.config/Code/User/keybindings.json"
|
|
"vscode/settings.json:$HOME/.config/Code/User/settings.json"
|
|
"codex/config.toml:$HOME/.codex/config.toml"
|
|
"codex/default.rules:$HOME/.codex/rules/default.rules"
|
|
"codex/AGENTS.md:$HOME/.codex/AGENTS.md"
|
|
)
|
|
|
|
# Back up originals that haven't been backed up yet.
|
|
mkdir -p "$HOME/.orig-config"
|
|
for entry in "${FILES[@]}"; do
|
|
src_rel="${entry%%:*}"
|
|
target="${entry#*:}"
|
|
backup="$HOME/.orig-config/$src_rel"
|
|
if [ ! -e "$backup" ] && [ -e "$target" ] && [ ! -L "$target" ]; then
|
|
mkdir -p "$(dirname "$backup")"
|
|
cp "$target" "$backup"
|
|
echo "Backed up $target"
|
|
fi
|
|
done
|
|
|
|
# Create symlinks.
|
|
for entry in "${FILES[@]}"; do
|
|
src="$REPO_DIR/${entry%%:*}"
|
|
target="${entry#*:}"
|
|
mkdir -p "$(dirname "$target")"
|
|
ln -sf "$src" "$target"
|
|
echo "Linked $target -> $src"
|
|
done
|