-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·36 lines (30 loc) · 851 Bytes
/
setup
File metadata and controls
executable file
·36 lines (30 loc) · 851 Bytes
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
#!/bin/zsh
DOTFILES_DIR="$HOME/Repos/github.com/9albi/dotfiles"
XDG_CONFIG_HOME="$HOME/.config"
EXCLUDE_FILES=(.git .gitignore README.md .DS_Store scripts starship.toml)
is_excluded() {
local file="$1"
for exclude in "${EXCLUDE_FILES[@]}"; do
if [[ "$file" == "$exclude" ]]; then
return 0
fi
done
return 1
}
for item in "$DOTFILES_DIR"/*(D); do
filename=$(basename "$item")
# Check if the file should be excluded
if is_excluded "$filename"; then
echo "Skipping $filename"
continue
fi
# Symlink regular files to $HOME
if [[ -f "$item" ]]; then
ln -sfn "$item" "$HOME/$filename"
echo "Symlinked $filename$"
elif [[ -d "$item" ]]; then
ln -sfn "$item" "$XDG_CONFIG_HOME/$filename"
echo "Symlinked $filename to $XDG_CONFIG_HOME/$filename"
fi
done
ln -sfn "$DOTFILES_DIR/bin" "$HOME/bin"