dotfiles/install.sh

43 lines
954 B
Bash
Raw Permalink Normal View History

2025-01-15 10:57:33 +00:00
#!/bin/sh
set -e
2025-01-15 11:24:31 +00:00
# Create config directories
2025-01-15 10:57:33 +00:00
mkdir -p "$HOME/.config"
2025-01-15 11:24:31 +00:00
# Handle .config directory symlinks first
2025-01-15 10:57:33 +00:00
cd "$HOME/dotfiles/config" || exit 1
for dir in *; do
[ -d "$dir" ] || continue
target="$HOME/.config/$dir"
if [ -L "$target" ]; then
echo "Skipping $dir (symlink already exists)"
continue
elif [ -e "$target" ]; then
echo "Skipping $dir (target exists and is not a symlink)"
continue
fi
ln -sf "$PWD/$dir" "$target"
echo "Linked $dir"
done
2025-01-15 11:24:31 +00:00
# Handle root directory dotfiles
cd "$HOME/dotfiles/root" || exit 1
for file in *; do
[ -f "$file" ] || continue
target="$HOME/.$file"
if [ -L "$target" ]; then
echo "Skipping .$file (symlink already exists)"
continue
elif [ -e "$target" ]; then
echo "Skipping .$file (target exists and is not a symlink)"
continue
fi
ln -sf "$PWD/$file" "$target"
echo "Linked .$file"
done