Last active
October 15, 2020 08:38
-
-
Save Crandel/d5bbf38f4d6f449e282d5aeffcbe0384 to your computer and use it in GitHub Desktop.
install tmux without root
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 | |
# Script for installing tmux on systems where you don't have root access. | |
# tmux will be installed in $HOME/local/bin. | |
# It's assumed that wget and a C/C++ compiler are installed. | |
# exit on error | |
set -e | |
TMUX_VERSION=2.5 | |
TMUX_DIR=tmux-${TMUX_VERSION} | |
LIBEVENT_VERSION=2.1.8-stable | |
LIBEVENT_DIR=libevent-${LIBEVENT_VERSION} | |
NCURCES_VERSION=6.0 | |
NCURCES_DIR=ncurses-${NCURCES_VERSION} | |
LOCAL_DIR=$HOME/.local | |
BIN_DIR=$LOCAL_DIR/bin | |
TMP_DIR=$HOME/tmux_tmp | |
# create our directories | |
mkdir -p $BIN_DIR $TMP_DIR | |
cd $TMP_DIR | |
# download source files for tmux, libevent, and ncurses | |
wget -O ${LIBEVENT_DIR}.tar.gz https://github.com/libevent/libevent/releases/download/release-${LIBEVENT_VERSION}/libevent-${LIBEVENT_VERSION}.tar.gz | |
wget -O ${NCURCES_DIR}.tar.gz http://ftp.gnu.org/gnu/ncurses/${NCURCES_DIR}.tar.gz | |
wget -O ${TMUX_DIR}.tar.gz https://github.com/tmux/tmux/releases/download/${TMUX_VERSION}/tmux-${TMUX_VERSION}.tar.gz | |
# extract files, configure, and compile | |
############ | |
# libevent # | |
############ | |
tar xvzf ${LIBEVENT_DIR}.tar.gz | |
cd ${LIBEVENT_DIR} | |
./configure --prefix=$LOCAL_DIR --disable-shared | |
make | |
make install | |
cd .. | |
############ | |
# ncurses # | |
############ | |
tar xvzf ${NCURCES_DIR}.tar.gz | |
cd ${NCURCES_DIR} | |
# patch ncurses for gcc > 5.0 | |
wget https://raw.githubusercontent.com/PandaLinux/base-64/master/patches/ncurses-6.0-gcc-5.patch | |
patch ncurses/base/MKlib_gen.sh < ncurses-6.0-gcc-5.patch | |
./configure --prefix=$LOCAL_DIR | |
make | |
make install | |
cd .. | |
############ | |
# tmux # | |
############ | |
tar xvzf ${TMUX_DIR}.tar.gz | |
cd ${TMUX_DIR} | |
./configure CFLAGS="-I$LOCAL_DIR/include -I$LOCAL_DIR/include/ncurses" LDFLAGS="-L$LOCAL_DIR/lib -L$LOCAL_DIR/include/ncurses -L$LOCAL_DIR/include" | |
CPPFLAGS="-I$LOCAL_DIR/include -I$LOCAL_DIR/include/ncurses" LDFLAGS="-static -L$LOCAL_DIR/include -L$LOCAL_DIR/include/ncurses -L$LOCAL_DIR/lib" make | |
cp tmux $BIN_DIR | |
cd .. | |
# cleanup | |
rm -rf $TMP_DIR | |
echo "$BIN_DIR/tmux is now available. You can optionally add $BIN_DIR to your PATH." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Скрипт до конца не отрабатывает, ошибка 404 на 50 строке, где выполняется
wget https://raw.githubusercontent.com/PandaLinux/base-64/master/patches/ncurses-6.0-gcc-5.patch
Пробовал найти копию в других репозиториях, нашел
https://raw.githubusercontent.com/easybuilders/easybuild-easyconfigs/master/easybuild/easyconfigs/n/ncurses/ncurses-6.0_gcc-5.patch
но скрипт далее ругнулся, что
patch: **** Only garbage was found in the patch input.