dotfiles/bootstrap
Smirnov Oleksandr a7f3f62e40
refactor(bootstrap): make shellcheck happy....
btw while making this commit i just questioned why the f i did? i mean
it works, then why to rewrite it
2024-10-22 13:00:28 +03:00

32 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
set -e
# the path to dir where the script and dotfiles are located
# set to specific path so this script can be run from anywhere
dotfilesPath="$HOME/.dotfiles"
create_links_in_dir_recursively() {
local base_dir="$dotfilesPath/$1"
local target_dir="$2"
find "$base_dir/" -type d | while read -r dir; do
mkdir -p "$HOME/$target_dir${dir#"$base_dir"}"
find "$dir" -maxdepth 1 -type f | while read -r file; do
ln -sf "$file" "$HOME/$target_dir${file#"$base_dir"}"
done
done
}
ln -sf "$dotfilesPath/zshrc" "$HOME/.zshrc"
ln -sf "$dotfilesPath/gitconfig" "$HOME/.gitconfig"
ln -sf "$dotfilesPath/tmux.conf" "$HOME/.tmux.conf"
mkdir -p "$HOME/bin/"
find "$dotfilesPath/bin" -type f -exec ln -sf {} "$HOME/bin/" \;
create_links_in_dir_recursively "config" ".config"
ln -sf "$dotfilesPath/config/alacritty.yml" "$HOME/.config/alacritty.yml"
ln -sf "$dotfilesPath/config/electron-flags.conf" "$HOME/.config/electron-flags.conf"
ln -sf "$dotfilesPath/config/starship.toml" "$HOME/.config/starship.toml"
create_links_in_dir_recursively "logseq" ".logseq"