-
Notifications
You must be signed in to change notification settings - Fork 9
/
install
executable file
·91 lines (76 loc) · 2.39 KB
/
install
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
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
# Given this is running inside a bash script, some of the errors are swallowed, so
# settings -e here might make it harder to debug stuff when errors happen. Given how
# the code is written, modular, it's totally fine if a piece of it fails. No reason to
# halt the entire process.
#
# set -e
# This is for making it possible to use stdin for user input during the installation.
exec < /dev/tty
# MacOS?
if [[ "$OSTYPE" == "darwin"* ]]; then
if [ ! -f ~/.bash_profile ]; then
echo "Creating ~/.bash_profile"
touch ~/.bash_profile
fi
if [ ! -f ~/.ssh/id_rsa.pub ]; then
echo "No id_rsa.pub found. This is used to authenticate with Github/Gitlab. Let's generate a new key now."
read -p "Enter your email address on Github: " github_email
ssh-keygen -t rsa -b 4096 -C "$github_email"
echo ""
echo "Copy the text below and upload to https://github.com/settings/ssh/new:"
echo ""
cat ~/.ssh/id_rsa.pub
echo ""
read -n 1 -s -r -p "Press any key to continue"
fi
fi
if [ -d ~/.dotfiles ]
then
LAST_DIR=$(pwd)
echo "Directory ~/.dotfiles found, make sure git status is clean."
echo "git pulling from master"
cd ~/.dotfiles
git pull --rebase origin master
cd $LAST_DIR
else
echo "Cloning git@github.com:kurko/dotfiles.git into ~/.dotfiles"
git clone git@github.com:kurko/dotfiles.git ~/.dotfiles
fi
echo ""
echo "sourcing ~/.dotfiles/bashrc_source... "
source ~/.dotfiles/bashrc_source
echo ""
echo "Updating aliases, links and scripts... "
update_dotfiles
# MacOS?
if [[ "$OSTYPE" == "darwin"* ]]; then
echo ""
echo "Installing MacOS software... "
source $DOTFILES/installation/macos
install_macos
elif [[ "$OSTYPE" == "linux-gnu" ]]; then
echo ""
echo "Installing Linux GNU software... "
source $DOTFILES/installation/linux_gnu
install_linux_gnu_packages
fi
source $DOTFILES/installation/os_agnostic_packages
install_os_agnostic_packages
if [ ! -f ~/.vim/autoload/plug.vim ]
then
echo ""
printf "Vim plugin manager: "
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
else
echo "Vim plugin manager: done. "
fi
vim +'PlugInstall --sync' +qa
if [ ! -d ~/.tmux/plugins/tpm ]
then
echo ""
echo "Install Tmux Plugin Manager on ~/.tmux/plugins/tpm... "
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
~/.tmux/plugins/tpm/bin/install_plugins
fi