-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·72 lines (61 loc) · 2.17 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
#!/bin/bash
set -e
set -u
set -o pipefail
TMUX_VERSION=3.2a
is_app_installed() {
type "$1" &>/dev/null
}
install_dependencies() {
if is_app_installed apt; then
sudo apt update
sudo apt-get -y install expect git telnet
elif is_app_installed pacman; then
sudo pacman -Sy expect git
fi
}
install_tmux() {
# Installing dependencies
if [ ! -e "$HOME/tmuxNOC/" ]; then
mkdir "$HOME/tmuxNOC"
fi
cd ~/tmuxNOC/
if is_app_installed apt; then
sudo apt update
sudo apt-get -y install wget
# Downloading .appimage and installing it.
wget https://github.com/antontkv/tmux-appimage/releases/download/$TMUX_VERSION/tmux-$TMUX_VERSION-x86_64.appimage
chmod +x tmux-$TMUX_VERSION-x86_64.appimage
sudo mv tmux-$TMUX_VERSION-x86_64.appimage /usr/local/bin/tmux
elif is_app_installed pacman; then
sudo pacman -Sy tmux
else
printf "\nNor apt nor pacman found in the system.\n"
exit
fi
}
if ! is_app_installed expect || ! is_app_installed git || ! is_app_installed telnet; then
printf "\nYou don't have expect, git or telnet installed on the system.\n\
To install them you'll need sudo rights.\n\n"
read -p "Press Enter to continue..."
install_dependencies
fi
if ! is_app_installed tmux; then
printf "\nTmux is not installed. Version $TMUX_VERSION will be downloaded and installed from \
https://github.com/antontkv/tmux-appimage/releases or from pacman if on Arch.\n\
To install you'll need sudo rights.\n\n"
read -p "Press Enter to continue..."
install_tmux
elif ! tmux -V | grep -q $TMUX_VERSION; then
printf "\nWARNING: You have$(tmux -V | sed s/tmux//) tmux version installed.\nThis project was tested on \
$TMUX_VERSION tmux version. So something may be broken.\nYou can cancel this script and remove tmux from the \
system. Then run the script again, it will install needed version of tmux.\n\n"
read -p "Press Enter to continue..."
fi
if [ -e "$HOME/.tmux.conf" ]; then
printf "\nFound existing .tmux.conf in your \$HOME directory. \
Will create a backup at $HOME/.tmux.conf.bak\n"
fi
cp -f "$HOME/.tmux.conf" "$HOME/.tmux.conf.bak" 2>/dev/null || true
ln -sf "$HOME"/tmuxNOC/tmux.conf "$HOME"/.tmux.conf;
printf "\nOK: Completed\n"