|
1 | 1 | #!/bin/bash |
2 | | -set -e |
| 2 | +# Simple dotfiles installer for Antonio |
| 3 | +set -euo pipefail |
| 4 | + |
| 5 | +# Always work from the directory where this script lives |
| 6 | +REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 7 | + |
| 8 | +link_optional_config() { |
| 9 | + local source_path="$1" |
| 10 | + local target_path="$2" |
| 11 | + local label="$3" |
| 12 | + |
| 13 | + if [ -f "$source_path" ]; then |
| 14 | + echo "🔗 Linking $label…" |
| 15 | + ln -sf "$source_path" "$target_path" |
| 16 | + echo " ✅ $label installed." |
| 17 | + else |
| 18 | + echo "⚪️ Skipping $label (not found)." |
| 19 | + fi |
| 20 | +} |
3 | 21 |
|
4 | 22 | if ! command -v fzf >/dev/null 2>&1; then |
5 | | - echo "⚠️ Missing dependency: fzf" |
6 | | - echo " Please install fzf (e.g., 'sudo pacman -S fzf') and re-run this script." |
7 | | - exit 1 |
| 23 | + echo "⚠️ Missing dependency: fzf" |
| 24 | + echo " Please install fzf (e.g., 'sudo pacman -S fzf') and re-run this script." |
| 25 | + exit 1 |
8 | 26 | fi |
9 | 27 |
|
10 | 28 | echo "🔗 Linking zsh config…" |
11 | | -ln -sf "$PWD/zsh/.zshrc" "$HOME/.zshrc" |
| 29 | +ln -sf "$REPO_DIR/zsh/.zshrc" "$HOME/.zshrc" |
12 | 30 |
|
13 | | -echo "🔗 Linking git config…" |
14 | | -ln -sf "$PWD/git/gitconfig" "$HOME/.gitconfig" |
| 31 | +echo "🔗 Linking main git config…" |
| 32 | +ln -sf "$REPO_DIR/git/gitconfig" "$HOME/.gitconfig" |
15 | 33 |
|
16 | | -echo "✨ Done! Reload your shell." |
| 34 | +link_optional_config "$REPO_DIR/git/gitconfig_qustodio" "$HOME/.gitconfig_qustodio" "Qustodio git config" |
| 35 | +link_optional_config "$REPO_DIR/git/gitconfig_local" "$HOME/.gitconfig_local" "local git config" |
| 36 | +link_optional_config "$REPO_DIR/git/gitignore_global" "$HOME/.gitignore_global" "global gitignore" |
17 | 37 |
|
| 38 | +echo "✨ Done! Reload your shell or start a new terminal." |
0 commit comments