dotfiles
shell, editor, ssh.
git clone https://owenrusk.dev/dotfiles.git
dotfiles / install.sh -rwxr-xr-x · 753 bytes
1 #!/bin/sh
2 # symlink everything into place. safe to run twice.
3 set -eu
4 here=$(cd "$(dirname "$0")" && pwd)
5
6 link() {
7 src=$here/$1
8 dst=$2
9 mkdir -p "$(dirname "$dst")"
10 # a real file in the way gets moved aside, not linked into
11 if [ -e "$dst" ] && [ ! -L "$dst" ]; then
12 mv "$dst" "$dst.orig"
13 echo "moved $dst to $dst.orig"
14 fi
15 ln -sfn "$src" "$dst"
16 }
17
18 link zsh/zshenv "$HOME/.zshenv"
19 link zsh/zshrc "$HOME/.zshrc"
20 link nvim "$HOME/.config/nvim"
21 link tmux/tmux.conf "$HOME/.tmux.conf"
22 link git/config "$HOME/.config/git/config"
23 link git/ignore "$HOME/.config/git/ignore"
24 link ssh/config "$HOME/.ssh/config"
25 chmod 700 "$HOME/.ssh"
26
27 for f in "$here"/bin/*; do
28 link "bin/${f##*/}" "$HOME/.local/bin/${f##*/}"
29 done