-
Notifications
You must be signed in to change notification settings - Fork 42
/
setup_all.sh
executable file
·47 lines (37 loc) · 990 Bytes
/
setup_all.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
# set -e # Exit on error
# set -o pipefail # Exit on pipe error
# set -x # Enable verbosity
# Dont link DS_Store files
find . -name ".DS_Store" -exec rm {} \;
PROGRAMS=(alias bash env git python scripts stow tmux vim zsh)
# PROGRAMS=(alias aspell bash env git latex python scripts stow tmux vim zsh mac terminal)
OLD_DOTFILES="dotfile_bk_$(date -u +"%Y%m%d%H%M%S")"
mkdir $OLD_DOTFILES
function backup_if_exists() {
if [ -f $1 ];
then
mv $1 $OLD_DOTFILES
fi
if [ -d $1 ];
then
mv $1 $OLD_DOTFILES
fi
}
# Clean common conflicts
backup_if_exists ~/.bash_profile
backup_if_exists ~/.bashrc
backup_if_exists ~/.zshrc
backup_if_exists ~/.gitconfig
backup_if_exists ~/.tmux.conf
backup_if_exists ~/.profile
mkdir -p ~/.vim/undodir
for f in ~/.zprezto/runcoms/z*
do
mv "$f" $OLD_DOTFILES
done
for program in ${PROGRAMS[@]}; do
stow -v --target=$HOME $program
echo "Configuring $program"
done
echo "Done!"