Last active
October 5, 2016 08:08
-
-
Save lowply/3ebdf81310a99e45f90bef1d3e07d82d to your computer and use it in GitHub Desktop.
A shell script to install tmux-2.3 and its dependencies from tarball (Only for CentOS and Ubuntu)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install tmux from source | |
# Jul 12th, 2016 / [email protected] | |
set -e | |
[ -f /etc/os-release ] && . /etc/os-release || { echo "Could not find /etc/os-release"; exit 1; } | |
TMUX_URL="https://github.com/tmux/tmux/releases/download/2.3/tmux-2.3.tar.gz" | |
LIBEVENT_URL="https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz" | |
NCURSES_URL="ftp://ftp.gnu.org/gnu/ncurses/ncurses-6.0.tar.gz" | |
WORKDIR="/tmp" | |
BUILD_DIR="${WORKDIR}/tmux_build_$(date +%y%m%d_%H%M%S)" | |
PKGCONFIG_DIR="${BUILD_DIR}/lib/pkgconfig" | |
TARGET_DIR="/usr/local/tmux" | |
TERMINFO_DIR_PATH="/usr/share/terminfo" | |
TERMINFO_DIRS_PATH="/etc/terminfo:/lib/terminfo:/usr/share/terminfo" | |
cd ${WORKDIR} | |
if [ "${NAME}" = "Ubuntu" ]; then | |
echo "Installing tmux for Ubuntu..." | |
sudo apt-get build-dep tmux | |
sudo apt-get install build-essential autoconf libtool pkg-config | |
curl -kOL ${TMUX_URL} && tar vxzf tmux-2.3.tar.gz | |
cd tmux-2.3 | |
./configure --prefix=${TARGET_DIR} && make && sudo make install | |
cd .. | |
rm -rf tmux-2.3 | |
elif [ "${NAME}" = "CentOS Linux" ]; then | |
echo "Installing tmux for CentOS..." | |
sudo yum install glibc-static automake autoconf pkgconfig | |
mkdir ${BUILD_DIR} | |
echo "########################" | |
echo "BUILDING LIBEVENT..." | |
echo "########################" | |
curl -kOL ${LIBEVENT_URL} && tar vxzf libevent-2.0.22-stable.tar.gz | |
cd libevent-2.0.22-stable | |
./configure --prefix=${BUILD_DIR} && make && make install | |
cd .. | |
rm -rf libevent-2.0.22-stable* | |
echo "########################" | |
echo "BUILDING NCURSES..." | |
echo "########################" | |
curl -kOL ${NCURSES_URL} && tar vxzf ncurses-6.0.tar.gz | |
cd ncurses-6.0 | |
./configure --prefix=${BUILD_DIR} --enable-pc-files --with-pkg-config-libdir=${PKGCONFIG_DIR} --with-default-terminfo-dir=${TERMINFO_DIR_PATH} --with-terminfo-dirs=${TERMINFO_DIRS_PATH} && make && make install | |
cd .. | |
rm -rf ncurses-6.0* | |
echo "########################" | |
echo "BUILDING TMUX..." | |
echo "########################" | |
curl -kOL ${TMUX_URL} && tar vxzf tmux-2.3.tar.gz | |
cd tmux-2.3 | |
PKG_CONFIG_PATH=${PKGCONFIG_DIR} ./configure --enable-static --prefix=${TARGET_DIR} && make && sudo make install | |
cd .. | |
rm -rf tmux-2.3* | |
else | |
echo "Your OS is neither Ubuntu or CentOS" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment