#!/bin/bash # File: install_tmux.sh # Date: 9 June 2012 # Creator: Trevor N. Suarez (He suggested the process of doing this on his website.) # Creator: Craig Laparo (He made Trevor's idea into a script) # Creator: Jason Charney (jrcharneyATgmailDOTcom) (I updated it.) # References: # See http://blennd.com/post/the-pains-of-installing-tmux-on-a-shared-server/ # for the original posts made by Trevor and Craig. # Info: # WARNING! CHECK WITH YOUR ADMINSTRATOR'S SOFTWARE INSTALLATION POLICY BEFORE RUNNING THIS SCRIPT! # My webhost is cool with letting me do this, but yours might not be. YMMV! # NOTE: This script does not install ncurses. You might want todo that if you don't have it. # NOTE: export variables to .bash_profile NOT .bashrc if you are using SSH # TODO: What if I need to upgrade the softwares? # UPDATE: Made some modifications that will be the format in the future for installation scripts. # WARNING! Be sure to update the upgrade variables for your computers needs! # Make the directories cd ~ mkdir local mkdir temp DIR=$HOME/local # Export # NOTE: These variables were set for the DIR directory. # If you use the default values or use a differen DIR, # CHANGE THESE VARIABLES! It's very important! # Note: export to .bash_profile NOT .bashrc # TODO: Why not use tee commands here? if [ -z $(echo $PATH | grep "$HOME/local/bin") ]; then export PATH=$HOME/local/bin:$PATH echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bash_profile fi if [ -z $(echo $LD_LIBRARY_PATH | grep "$HOME/local/lib") ]; then export LD_LIBRARY_PATH="$HOME/local/lib" echo 'export LD_LIBRARY_PATH="$HOME/local/lib"' >> ~/.bash_profile fi # The Cart # The cart is a collection of URLs that link to a package. cart=( http://iweb.dl.sourceforge.net/project/tmux/tmux/tmux-1.6/tmux-1.6.tar.gz https://github.com/downloads/libevent/libevent/libevent-2.0.19-stable.tar.gz ) # Download and Extract cd temp for url in "${cart[@]}" do pkg=${url##*/} wget ${url} --no-check-certificate && tar xvzf ${pkg} done # Install libevents and tmux cd libevent* ./configure --prefix=$DIR && make && make install cd ../tmux* ./configure CFLAGS="-I$DIR/include" LDFLAGS="-L$DIR/lib" && make && cp tmux ~/local/bin # Clean up cd ~ # rm -rf temp # This is a bad idea! Do this manually later so that you can check any error logs. # TODO: Save the packages in temp but delete the install directories in temp echo "DONE! Hopefully tmux has installed correctly. If so, delete temp later."