-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·68 lines (51 loc) · 1.9 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
#!/bin/bash
# Inspired by https://github.com/georgebrock/dotfiles/blob/a9af0fb751c96eb65fc7b8aa1312a37b8bc12558/install.sh
exec > >(tee -i "$HOME/dotfiles_install.log")
exec 2>&1
set -x
echo "Running in $(pwd)\n"
echo "=== Beginning installing dotfiles on $(date)."
if [[ -z $STOW_FOLDERS ]]; then
STOW_FOLDERS="bash,git,inputrc,pry,psql,ssh,tmux"
fi
if [ "$CODESPACES" = "true" ] || [ "$(uname)" = "Linux" ]; then
echo '📦️ Installing a few packages…'
$(sudo apt-get update) && echo "Updated apt"
sudo apt-get install --yes stow tmux vim exuberant-ctags
elif [[ "$(uname)" = "Darwin" ]]; then
brew install stow
else
>&2 echo "error: Unknown system"
exit 1
fi
# Backup common existing files
for f in .bashrc .bash_profile; do
if [ -e ~/$f ]; then
mv ~/$f ~/$f.bak
fi
done
echo "🎁 Stow dotfiles"
stow --target="$HOME" --stow bash git inputrc pry psql tmux vim
if [[ "$CODESPACES" = "true" ]]; then
# Default to HTTPS for GitHub access
git config --global url.https://github.com/.insteadOf [email protected]:
# We don't have Mac's pbcopy on Codespaces, replace with echo in gitconfig:
sed -i 's/pbcopy/echo/g' git/.gitconfig-aliases
fi
git config --global include.path ~/.gitconfig-aliases
# Git prompt/completion setup
if [[ "$CODESPACES" = "true" ]]; then
curl -L https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh > ~/.bash_git
fi
if [[ ! -d "$HOME/.vim/autoload/plug.vim" ]]; then
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
vim -es -u "$HOME/.vimrc" -i NONE -c "PlugInstall" -c "qa"
# Man pages are necessary -- these install them on Codespaces
if [[ "$CODESPACES" = "true" ]]; then
echo "🚀 Codespaces specific manpage setup"
sudo apt install -y --ignore-missing man-db doc-base
printf 'y' | sudo unminimize
fi
echo "=== Completed installing dotfiles on $(date)."