-
Notifications
You must be signed in to change notification settings - Fork 498
/
install.sh
executable file
·48 lines (26 loc) · 885 Bytes
/
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
#!/bin/bash
set -e
set -u
is_app_installed() {
type "$1" &>/dev/null
}
REPODIR="$(cd "$(dirname "$0")"; pwd -P)"
cd "$REPODIR";
if ! is_app_installed tmux; then
printf "$(tput setaf 1)WARNING:$(tput sgr0) \"tmux\" command is not found. \
Install it first\n"
exit 1
fi
if [ ! -e "$HOME/.tmux/plugins/tpm" ]; then
printf "$(tput setaf 1)WARNING:$(tput sgr0) Cannot found TPM (Tmux Plugin Manager) \
at default location: \$HOME/.tmux/plugins/tpm. Install it first\n"
exit 1
fi
if [ -e "$HOME/.tmux.conf" ]; then
printf "Found existing .tmux.conf in your \$HOME directory. Will create a backup at $HOME/.tmux.conf.bak\n"
fi
rsync -aq ./tmux/ "$HOME"/.tmux
ln -sf --backup --suffix=.bak .tmux/tmux.conf "$HOME"/.tmux.conf;
# BUG: Fix for fresh installation
"$HOME"/.tmux/plugins/tpm/bin/install_plugins
printf "$(tput setaf 2)OK:$(tput sgr0) Completed\n"