-
Notifications
You must be signed in to change notification settings - Fork 7
/
.install.sh
executable file
·89 lines (65 loc) · 2.66 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
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env bash
# Use GNU Stow to install dotfiles
echo "[*] Symlinking dotfiles ..."
mv README.md .README.md
mv ~/.bashrc ~/.bashrc.old
mv ~/.zshrc ~/.zshrc.old
stow *
mv .README.md README.md
echo "[*] Done."
cat <<EOF
[*] Do you want to install additional packages? (If you're not sure, answer "no")
* Dependencies (make sure they have been installed):
+ curl (for fetching oh-my-zsh installer script)
* The following packages will be installed:
+ oh-my-zsh (via the installer script from https://github.com/ohmyzsh/ohmyzsh)
+ vundle (git clone from https://github.com/VundleVim/Vundle.vim)
+ displayctl (git clone from https://github.com/aesophor/displayctl)
+ py-todo (git clone from https://github.com/aesophor/py-todo)
* These files/directories will be created on your filesystem:
+ ~/.config/oh-my-zsh
+ ~/.vim/backups
+ ~/.vim/bundle/Vundle.vim
+ /usr/local/bin/displayctl (requires sudo permission)
+ /usr/local/bin/py-todo (requires sudo permission)
EOF
read -p "Confirm? (Y/n)" -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
ohmyzsh_install_dest="~/.config/oh-my-zsh"
vundle_install_dest="~/.vim/bundle/Vundle.vim"
displayctl_clone_dest="~/Code/displayctl"
py_todo_clone_dest="~/Code/py-todo"
# My gitconfig uses ssh, so I'll hide it temporarily to make git clone works.
mv ~/.config/git/config ~/.config/git/config.old
# Install oh-my-zsh
if [ ! -d $ohmyzsh_install_dest ]; then
echo "[*] Installing oh-my-zsh to $ohmyzsh_install_dest ..."
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
mv ~/.oh-my-zsh ~/.config/oh-my-zsh
if [ -f ~/.zshrc.pre-oh-my-zsh ]; then
rm ~/.zshrc
mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc
fi
else
echo "[!] $ohmyzsh_install_dest already exists, skipping..."
fi
# Prepare vim/neovim with vundle
echo "[*] Preparing vim/neovim with vundle ..."
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
mkdir -p ~/.vim/backups
echo "[*] Done. Open vim and run the command :PluginInstall"
# Install my personal tools
echo "[*] Installing displayctl and py-todo ..."
mkdir -p ~/Code
if [ ! -d $displayctl_clone_dest ]; then
git clone https://github.com/aesophor/displayctl.git "$displayctl_clone_dest"
sudo cp -a $displayctl_clone_dest/displayctl /usr/local/bin/displayctl
fi
if [ ! -d ~/Code/py-todo ]; then
git clone https://github.com/aesophor/py-todo.git "$py_todo_clone_dest"
sudo cp -a $py_todo_clone_dest/todo /usr/local/bin/todo
fi
# Restore my gitconfig.
mv ~/.config/git/config.old ~/.config/git/config
fi