|
1
|
#!/usr/bin/env bash |
|
2
|
set -e |
|
3
|
|
|
4
|
# the path to dir where the script and dotfiles are located |
|
5
|
# set to specific path so this script can be run from anywhere |
|
6
|
dotfilesPath="$HOME/.dotfiles" |
|
7
|
|
|
8
|
create_links_in_dir_recursively() { |
|
9
|
local base_dir="$dotfilesPath/$1" |
|
10
|
local target_dir="$2" |
|
11
|
|
|
12
|
for dir in $(find "$base_dir/" -type d); do |
|
13
|
mkdir -p "$HOME/$target_dir${dir#$base_dir}" |
|
14
|
for file in $(find "$dir" -maxdepth 1 -type f); do |
|
15
|
ln -sf "$file" "$HOME/$target_dir${file#$base_dir}" |
|
16
|
done |
|
17
|
done |
|
18
|
} |
|
19
|
|
|
20
|
ln -sf "$dotfilesPath/zshrc" "$HOME/.zshrc" |
|
21
|
ln -sf "$dotfilesPath/gitconfig" "$HOME/.gitconfig" |
|
22
|
ln -sf "$dotfilesPath/tmux.conf" "$HOME/.tmux.conf" |
|
23
|
|
|
24
|
mkdir -p "$HOME/bin/" |
|
25
|
for file in $(find "$dotfilesPath/bin" -type f); do |
|
26
|
ln -sf "$file" "$HOME/bin" |
|
27
|
done |
|
28
|
|
|
29
|
create_links_in_dir_recursively "config" ".config" |
|
30
|
ln -sf "$dotfilesPath/config/alacritty.yml" "$HOME/.config/alacritty.yml" |
|
31
|
ln -sf "$dotfilesPath/config/electron-flags.conf" "$HOME/.config/electron-flags.conf" |
|
32
|
ln -sf "$dotfilesPath/config/starship.toml" "$HOME/.config/starship.toml" |
|
33
|
|
|
34
|
create_links_in_dir_recursively "logseq" ".logseq" |