-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
29 lines (23 loc) · 1.07 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
dotfiles=~/.config/dotfiles
bkdir=~/.cache/dotfiles-"$(date +"%Y%m%d-%H%M%S")"
link_file() {
[[ -z "$1" ]] && return -1
dest="${2:-.$1}"
echo "Setting up $dest"
[[ -L ~/"$dest" ]] && echo "Backing up $dest" && mkdir -p ${bkdir} && mv ~/"$dest" ${bkdir}/"$dest"
ln -s "$dotfiles/$1" ~/$dest
}
echo "Setting up .bashrc"
[[ -r ~/.bashrc ]] && echo "Backing up .bashrc" && mkdir -p ${bkdir} && mv ~/.bashrc ${bkdir}/.bashrc
echo -e ". $dotfiles/bashrc\n[[ -f $dotfiles.safe/bashrc ]] && . $dotfiles.safe/bashrc || true" > ~/.bashrc
echo "Setting up .zshrc"
[[ -r ~/.zshrc ]] && echo "Backing up .zshrc" && mkdir -p ${bkdir} && mv ~/.zshrc ${bkdir}/.zshrc
echo -e ". ~/.bashrc\n. $dotfiles/zshrc\n[[ -f $dotfiles.safe/zshrc ]] && . $dotfiles.safe/zshrc || true" > ~/.zshrc
# echo "Setting up .emacs"
# [[ -r ~/.emacs.d/init.el ]] && echo "Backing up init.el" mkdir -p ${bkdir} && && mv ~/.emacs.d/init.el ${bkdir}/.emacs.d/init.el.bk
# link_file "emacs.init.el" ".emacs.d/init.el"
link_file "tmux.conf"
link_file "gitconfig"
link_file "vimrc"
# link_file "xinitrc"