-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·79 lines (71 loc) · 2.01 KB
/
install.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
dryrun=''
no_backup=''
copy_dest="$HOME"
for opt in "$@"; do
case $opt in
-d|--dryrun|--dry-run)
echo "Dryrun mode active..."
dryrun=1
shift
;;
--no-backup)
no_backup=1
shift
;;
/*|./*)
echo "Taking $opt as install dir"
copy_dest=$opt
shift
;;
\?)
echo "Invalid options -$OPTARG" >&2
exit 1
;;
esac
done
default_backup_dir="${copy_dest}/.conf_backup"
confs='.tmux.conf .vimrc .zshrc .ssh/rc'
if [[ ! $no_backup ]]; then
if [[ $dryrun ]]; then
echo "Dryrun, not creating backup dir..."
elif [[ ! -d $default_backup_dir ]]; then
echo "Creating backup config dir at $default_backup_dir"
mkdir -p $default_backup_dir
fi
echo "Backing up configs to $default_backup_dir"
for conf in $confs; do
[[ ! $dryrun ]] && cp $copy_dest/$conf $default_backup_dir/
done
else
echo "Skipping backup due to --no-backup"
fi
echo "Copying in configs from git repo"
for conf in $confs; do
[[ ! $dryrun ]] && cp ./$conf $copy_dest/$conf
done
echo "Copying in rzsh"
if [[ ! $dryrun ]]; then
rzsh_home="$copy_dest/.config/rzsh"
rm -rf $rzsh_home
mkdir -p $rzsh_home
cp -r ./.config/rzsh/* $rzsh_home
fi
if [[ ! -d "$copy_dest/.vim/bundle/Vundle.vim" ]] && [[ ! $dryrun ]]; then
read -p "Would you like to install Vundle? [y/n]" v_choice
if [[ ${v_choice} = "y" ]]; then
echo "Installing Vundle!"
git clone https://github.com/VundleVim/Vundle.vim.git $copy_dest/.vim/bundle/Vundle.vim
else
echo "Skipping Vundle install"
fi
read -p "Would you like to install your plugins as well? [y/n]" v_choice
if [[ ${v_choice} = "y" ]]; then
echo "Installing Vundle Plugins!"
vim +PluginInstall +qall
else
echo "Skipping Vundle Plugin install"
fi
else
echo "Vundle already installed or dryrun, skipping"
fi