-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·65 lines (54 loc) · 1.68 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
#!/usr/bin/env bash
set -e
DIR=~/dotfiles/ # dotfiles repo -- the repo *HAS* to be cloned into the home directory
DEFAULT_UNSTOW="vim fish tmux git alacritty bin"
DEFAULT_PKGS="fish vim tmux git stow ctags"
install_stuff () {
# Figure out which package manager to use
platform=$(uname)
if [[ $platform == 'Linux' ]]; then
if [[ -f /etc/redhat-release ]]; then
PKG_MANAGER_CMD="sudo dnf install"
elif [[ -f /etc/debian_version ]]; then
PKG_MANAGER_CMD="sudo apt-get install"
elif [[ -f /etc/arch-release ]]; then
PKG_MANAGER_CMD="sudo pacman -S"
else
echo "Unhandled Linux distro -- giving up forever"
exit 1
fi
elif [[ $platform == 'Darwin' ]]; then
echo "OSX is unhandled for now -- giving up forever"
echo "TODO: automate installation of homebrew and then continue"
exit 1
fi
# Let's install some packages
$PKG_MANAGER_CMD $DEFAULT_PKGS
# Let's clone some specific git repos
if [[ ! -d ~/.vim/bundle/Vundle.vim ]]; then
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
fi
if [[ ! -d ~/.tmux/plugins/tpm ]]; then
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi
# Move the colliding .config/fish so stow doesn't error out
if [ -d ~/.config/fish ]; then
mv ~/.config/fish ~/.config/fish.old
fi
}
post_install () {
# Un-stow the default packages
# This has to go first in this function
cd $DIR
for package in ${DEFAULT_UNSTOW}; do
stow $package
done
# Install tmux plugins
~/.tmux/plugins/tpm/bin/install_plugins
# Install vim plugins
vim +PluginInstall +qall
# chsh over to fish
chsh -s $(which fish)
}
install_stuff
post_install