#!/bin/bash # File: install_lastbash.sh # Date: 9 June 2012 # Creator: Jason Charney (jrcharneyATgmailDOTcom) # Info: Initially designed to install shell-fm until the shell-fm programmer forgot to create a proper configuration file # WARNING! The export variables used in this script are designed for my needs. # If your's are different YOU MUST CHANGE THE VARIABLES! # Make the directories (if they don't exist) cd ~ mkdir local mkdir temp DIR=$HOME/local # this is where items are installed locally # 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 if [ -z $(echo $PKG_CONFIG_PATH | grep "$HOME/local/lib/pkgconfig") ]; then export PKG_CONFIG_PATH="$HOME/local/lib/pkgconfig" echo 'export PKG_CONFIG_PATH="$HOME/local/lib/pkgconfig"' >> ~/.bash_profile fi # The Cart # Add items (urls) to the cart. Put them in order # such that the ones at the bottom that are dependent on the ones # on the top install after their dependencies are installed. cart=( http://www.cmake.org/files/v2.8/cmake-2.8.8.tar.gz https://launchpad.net/taglib/trunk/1.7/+download/taglib-1.7.tar.gz http://iweb.dl.sourceforge.net/project/mad/libmad/0.15.1b/libmad-0.15.1b.tar.gz http://downloads.xiph.org/releases/ao/libao-1.1.0.tar.gz ) # Download and Extract cd ~/temp for $url in "${cart[$@]}" do pkg=${url##*/} # package name - The parent URL is striped out case ${pkg##*.} in # execute based on extension. Currently supported: .tar.bz2 (bz2), .tar.gz (gz), and .tar (tar) gz) tc=xvzf ;; bz2) tc=xvjf ;; tar) tc=xvf ;; *) "ERROR! Unrecognized extension. Aborting. You will have to do this yourself. Sorry."; exit 1 ;; esac if [ ! -e $pkg ]; then # If the package doesn't exist in the local directory, download and extract it wget ${url} --no-check-certificate && tar ${tc} ${pkg} # TODO: What do I do if wget doesn't download else # if the package exists, extract it. tar ${tc} ${pkg} fi done # Install (This part can't be streamlined.) cd cmake* ./configure --prefix=$DIR && make && make install cd ../taglib* cmake -DCMAKE_INSTALL_PREFIX=$DIR -DCMAKE_RELEASE_TYPE=Release . && make && make PREFIX="$DIR" DESTDIR="$DIR" install # libmad (required) cd ../libmad* # According to LinuxFromScratch.org, -fforce-mem needs to be removed because it doesn't work with GCC v4.4.x sed -i '/-fforce-mem/d' configure && ./configure --prefix=$DIR && make && make install # For some reason, libmad didn't create it's onw pkg-config file cat > $DIR/lib/pkgconfig/mad.pc << EOF # libmad pkg-config source file prefix=${DIR} exec_prefix=\${prefix} libdir=\${exec_prefix}/lib includedir=\${prefix}/include Name: mad Description: MPEG audio decoder Version: 0.15.1b Requires: Libs: -L\${libdir} -lmad Cflags: -I\${includedir} EOF # liboao is optional but having playback features would be good anyway. cd ../libao* # There was an extra instruction for installing the documentation. I've decided not to use it. # Configuration files are /etc/libao.conf (not going to use) and ~/.libao (More than likely will have to use.) ./configure --prefix=$DIR && make && make install # Clone and install (This is for git packages) # NOTE: There is no configure file. cd .. git clone git://github.com/jkramer/shell-fm.git shell-fm cd shell-fm make && make install PREFIX=$DIR/local MANDIR=$DIR/share/man # Cleanup # TODO: Compress shell-fm # TODO: Delete the non-compressed stuff in temp cd ~ echo "DONE! Shell-fm should be ready to go. Be sure to check my website for setting up shell-fm."