-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·41 lines (34 loc) · 1.08 KB
/
install
File metadata and controls
executable file
·41 lines (34 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
mkdir -p "$HOME/.config"
# setup xdg config
for dir in config/*/; do
[ -d "$dir" ] || continue
dirname=$(basename "$dir")
target="$HOME/.config/$dirname"
if [ -e "$target" ] && [ ! -L "$target" ]; then
echo "Warning: $target already exists and is not a symlink. Skipping $dirname."
continue
fi
# Remove existing symlink if it exists
[ -L "$target" ] && rm "$target"
ln -sf "$PWD/$dir" "$target"
echo "Created symlink: $target -> $PWD/$dir"
done
# setup home dotfiles
for file in home/*; do
[ -f "$file" ] || continue
filename=$(basename "$file")
# Add dot prefix for dotfiles (unless it already has one)
if [[ "$filename" != .* ]]; then
target="$HOME/.$filename"
else
target="$HOME/$filename"
fi
if [ -e "$target" ] && [ ! -L "$target" ]; then
echo "Warning: $target already exists and is not a symlink. Skipping $filename."
continue
fi
[ -L "$target" ] && rm "$target"
ln -sf "$PWD/$file" "$target"
echo "Created symlink: $target -> $PWD/$file"
done