-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup-tmux
executable file
·70 lines (57 loc) · 1.37 KB
/
setup-tmux
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
#!/usr/bin/env bash
set -euo pipefail
get_latest_reposiotry() {
local -r repo_uri="${1}"
local -r repo_dir="${2}"
echo "Repository URI: ${repo_uri}"
if [[ ! -d "${repo_dir}" ]]; then
echo "Cloning repository..."
mkdir -p "$(dirname "${repo_dir}")"
git clone --quiet --recursive "${repo_uri}" "${repo_dir}"
pushd "${repo_dir}" >/dev/null
else
echo "Pulling latest commits..."
pushd "${repo_dir}" >/dev/null
git pull
git submodule update --init
fi
popd >/dev/null
}
setup_for_darwin() {
if test -z "$(brew list | grep tmux)"; then
brew install --HEAD tmux
else
brew reinstall tmux
fi
}
setup_for_debian() {
local -r owner="tmux"
local -r repo="tmux"
get_latest_reposiotry "https://github.com/${owner}/${repo}" "${HOME}/Dev/github/${owner}/${repo}"
pushd "${HOME}/Dev/github/${owner}/${repo}" >/dev/null
echo "Installing dependencies..."
sudo apt install -y libevent-dev ncurses-dev build-essential bison pkg-config
echo "Running build..."
sh autogen.sh
./configure --enable-sixel --prefix="${HOME}/.local"
make
make install
echo "Setting up binary: tmux"
sudo ln -nsf "${HOME}/.local/bin/tmux" /usr/local/bin/tmux
echo "Done!"
}
setup() {
case "${OSTYPE}" in
darwin*)
setup_for_darwin
;;
linux*)
setup_for_debian
;;
*)
echo "Unknown OS!"
exit 1
;;
esac
}
setup