First attempt at adding mosh and tmux and new local install dir

This commit is contained in:
ViViDboarder 2016-06-06 17:16:47 -07:00
parent cdc9d5058c
commit a5f7b762d2
4 changed files with 137 additions and 1 deletions

View File

@ -10,7 +10,7 @@ function init_paths_and_vars {
# This is in bashrc
USER_BIN="$HOME/bin"
# Local prefix
LOCAL_PREFIX="$HOME/usr/local"
LOCAL_PREFIX="$HOME/.local"
# Temp dir for downloads
TMP_DIR="$PROJECT_DIR/tmp"
# System uname
@ -23,6 +23,7 @@ function init_paths_and_vars {
# Create workspace dir
mkdir -p $WORKSPACE
mkdir -p $USER_BIN
mkdir -p $LOCAL_PREFIX
mkdir -p $TMP_DIR
mkdir -p $XDG_DATA_HOME
mkdir -p $XDG_CONFIG_HOME

20
no-sudo
View File

@ -27,6 +27,16 @@ is_installed "salesforce"
if prompt_yn "Install Salesforce tools?" ; then
install_sfdc=true
fi
install_mosh=false
is_installed "mosh"
if prompt_yn "Install Mosh from source?" ; then
install_mosh=true
fi
install_tmux=false
is_installed "tmux"
if prompt_yn "Install tmux from source?" ; then
install_tmux=true
fi
install_fish=false
install_ohmyfish=false
install_fisherman=false
@ -63,6 +73,16 @@ if $install_sfdc ; then
set_installed 'salesforce'
fi
if $install_mosh ; then
recipe 'mosh'
set_installed 'mosh-install'
fi
if $install_tmux ; then
recipe 'tmux-install'
set_installed 'tmux'
fi
if $install_fish ; then
if ! command_exist fish ; then
recipe 'fish-install'

61
recipes/no-sudo/mosh-install Executable file
View File

@ -0,0 +1,61 @@
#! /bin/bash
set -e
read -p "Compile protobuf? [Yn] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Get library
v=protobuf-2.5.0
wget https://protobuf.googlecode.com/files/${v}.tar.gz
# Extract library
tar -xvzf ${v}.tar.gz
cd $v
# Configure and install
./configure --prefix=$LOCAL_PREFIX && make && make check && make install
if [ $? -ne 0 ]; then
echo "Error compiling $v"
exit 1
fi
# Exit the library directory
cd ..
fi
read -p "Compile ncurses? [Yn] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Get library
v=ncurses-5.9
wget http://ftp.gnu.org/pub/gnu/ncurses/${v}.tar.gz
# Extract library
tar -xvzf ${v}.tar.gz
cd $v
# Configure and install
./configure --with-shared --prefix=$LOCAL_PREFIX && make && make install
if [ $? -ne 0 ]; then
echo "Error compiling $v"
exit 1
fi
# Exit the library directory
cd ..
fi
# Clone mosh
git clone --depth 1 https://github.com/keithw/mosh
cd mosh
# Set the path for pkgconfig
export PKG_CONFIG_PATH=$LOCAL_PREFIX/lib/pkgconfig
export PATH=$LOCAL_PREFIX/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LOCAL_PREFIX/lib
# Do the configure and install
./autogen.sh
./configure --prefix=$LOCAL_PREFIX && make install
echo
echo "Make sure the following lines are in your bashrc"
echo "export PATH=$LOCAL_PREFIX/bin:"'$PATH'
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:'"$LOCAL_PREFIX/lib'

54
recipes/no-sudo/tmux-install Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
set -e
# Script for installing tmux and dependencies.
# tmux will be installed in /usr/local/lib by default.
# Prerequisites: - gcc
# - wget
# define versions
tmux_version="2.1"
tmux_patch_version="" # leave empty for stable releases
libevent_version="2.0.21"
ncurses_version="5.9"
tmux_full_version="$tmux_version$tmux_patch_version"
tmux_name="tmux-$tmux_full_version"
libevent_name="libevent-$libevent_version-stable"
ncurses_name="ncurses-$ncurses_version"
# Download source files for tmux, libevent, and ncurses to tmp dir
cd $TMP_DIR
curl -OL https://github.com/tmux/tmux/releases/download/$tmux_full_version/${tmux_name}.tar.gz
curl -O https://cloud.github.com/downloads/libevent/libevent/${libevent_name}.tar.gz
wget -O ${ncurses_name}.tar.gz ftp://ftp.gnu.org/gnu/ncurses/${ncurses_name}.tar.gz
# extract files, configure, and compile
# libevent installation
tar xvzf ${libevent_name}.tar.gz
(cd $libevent_name && ./configure --prefix=$LOCAL_PREFIX --disable-shared && make && make install) || exit 1
# ncurses installation
tar xvzf ${ncurses_name}.tar.gz
(cd $ncurses_name && ./configure --prefix=$LOCAL_PREFIX && make && make install) || exit 1
# tmux installation
tar xvzf ${tmux_name}.tar.gz
(\
cd ${tmux_name} && \
./configure CFLAGS="-I$LOCAL_PREFIX/include -I$LOCAL_PREFIX/include/ncurses" LDFLAGS="-L$LOCAL_PREFIX/lib -L$LOCAL_PREFIX/include/ncurses -L$LOCAL_PREFIX/include" && \
CPPFLAGS="-I$LOCAL_PREFIX/include -I$LOCAL_PREFIX/include/ncurses" LDFLAGS="-static -L$LOCAL_PREFIX/include -L$LOCAL_PREFIX/include/ncurses -L$LOCAL_PREFIX/lib" make && \
cp tmux $LOCAL_PREFIX/bin \
) || exit 1
version=`tmux -V | cut -d ' ' -f 2`
if [ -z "$version" ]; then
echo
echo "[error] failed to install tmux - check for errors in the above output"
exit 1
fi
cd $ROOT_DIR