all repos

dotfiles @ fbda8825a8e074f2d26f6446fac6bca3bed5a4d9

i use rach linux btw

dotfiles/bootstrap (view raw)

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
h() { # ln -sf and logs path
9
    ln -sf "$1" "$2"
10
    echo "[ln] $2"
11
}
12
13
mkd() { # mkdir -p and logs path
14
    mkdir -p "$1"
15
    echo "[mkdir] $1"
16
}
17
18
create_links_in_dir_recursively() {
19
  local base_dir="$dotfilesPath/$1"
20
  local target_dir="$2"
21
22
  find "$base_dir/" -type d | while read -r dir; do
23
    mkd "$HOME/$target_dir${dir#"$base_dir"}"
24
    find "$dir" -maxdepth 1 -type f | while read -r file; do
25
      h "$file" "$HOME/$target_dir${file#"$base_dir"}"
26
    done
27
  done
28
}
29
30
h "$dotfilesPath/zshrc" "$HOME/.zshrc"
31
h "$dotfilesPath/gitconfig" "$HOME/.gitconfig"
32
h "$dotfilesPath/tmux.conf" "$HOME/.tmux.conf"
33
34
mkd "$HOME/bin/"
35
find "$dotfilesPath/bin" -type f -exec ln -sf {} "$HOME/bin/" \;
36
37
create_links_in_dir_recursively "config" ".config"
38
h "$dotfilesPath/config/alacritty.yml" "$HOME/.config/alacritty.yml"
39
h "$dotfilesPath/config/electron-flags.conf" "$HOME/.config/electron-flags.conf"
40
h "$dotfilesPath/config/starship.toml" "$HOME/.config/starship.toml"
41
42
create_links_in_dir_recursively "logseq" ".logseq"