Smirnov Oleksandr
Smirnov Oleksandr
ss2316544@gmail.com refactor(bootstrap): make shellcheck happy......., 1 year ago
ss2316544@gmail.com refactor(bootstrap): make shellcheck happy......., 1 year ago
| 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 | find "$base_dir/" -type d | while read -r dir; do |
| 13 | mkdir -p "$HOME/$target_dir${dir#"$base_dir"}" |
| 14 | find "$dir" -maxdepth 1 -type f | while read -r file; 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 | find "$dotfilesPath/bin" -type f -exec ln -sf {} "$HOME/bin/" \; |
| 26 | |
| 27 | create_links_in_dir_recursively "config" ".config" |
| 28 | ln -sf "$dotfilesPath/config/alacritty.yml" "$HOME/.config/alacritty.yml" |
| 29 | ln -sf "$dotfilesPath/config/electron-flags.conf" "$HOME/.config/electron-flags.conf" |
| 30 | ln -sf "$dotfilesPath/config/starship.toml" "$HOME/.config/starship.toml" |
| 31 | |
| 32 | create_links_in_dir_recursively "logseq" ".logseq" |