Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·93 lines (73 loc) · 2.18 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·93 lines (73 loc) · 2.18 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/zsh
set -euo pipefail
setopt NULL_GLOB
setopt GLOB_DOTS
cd "$(dirname "$0")"
readonly BASE_DIR="$(pwd)"
readonly ZIM_HOME="$HOME/.zim"
create_symlink() {
local source="$1"
local target="$2"
if [[ ! -L "$target" ]]; then
[[ -f "$target" ]] && mv "$target" "${target}.bak"
ln -s "$source" "$target"
fi
}
setup_home_dotfiles() {
if [[ ! -L "$HOME/.home" ]]; then
ln -s "$BASE_DIR/home" "$HOME/.home"
fi
if [[ -d "$HOME/.home" ]]; then
for file in "$HOME/.home"/*; do
[[ -e "$file" ]] || continue
local filename="$(basename "$file")"
create_symlink ".home/$filename" "$HOME/$filename"
done
fi
}
setup_application_configs() {
if [[ ! -L "$HOME/.config/config" ]]; then
ln -s "$BASE_DIR/config" "$HOME/.config/config"
fi
if [[ -d "$HOME/.config/config" ]]; then
for file in "$HOME/.config/config"/*; do
[[ -e "$file" ]] || continue
local filename="$(basename "$file")"
create_symlink "config/$filename" "$HOME/.config/$filename"
done
fi
}
setup_claude() {
if [[ ! -L "$HOME/.claude/claude" ]]; then
ln -s "$BASE_DIR/claude" "$HOME/.claude/claude"
fi
if [[ -d "$HOME/.claude/claude" ]]; then
for file in "$HOME/.claude/claude"/*; do
[[ -e "$file" ]] || continue
local filename="$(basename "$file")"
create_symlink "claude/$filename" "$HOME/.claude/$filename"
done
fi
}
setup_zim() {
if [[ ! -e "$ZIM_HOME/zimfw.zsh" ]]; then
curl -fsSL --create-dirs -o "$ZIM_HOME/zimfw.zsh" \
https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
fi
if [[ ! "$ZIM_HOME/init.zsh" -nt "${ZDOTDIR:-$HOME}/.zimrc" ]]; then
source "$ZIM_HOME/zimfw.zsh" init -q
fi
}
main() {
echo "Setting up configuration..."
echo "Setting up home dotfiles..."
setup_home_dotfiles
echo "Setting up application configs..."
setup_application_configs
echo "Setting up Claude configs..."
setup_claude
echo "Setting up Zim framework..."
setup_zim
echo "Configuration setup complete!"
}
main "$@"