#!/bin/bash #this script was designed for use with checkinstall (http://asic-linux.com.mx/~izto/checkinstall/) #if you don't use checkinstall try running sed /s/sh checkinstall/sh make install/g instsrc or just get checkinstall. ARCH="$1" #add the name of the contents to a variable. $CONT meaning contents. if [ $1 = --help ] ; then echo 'instsrc will compile, make and then install source code with checkinstall.' echo 'just use the name of a .tar.gz or .tar.bz2 source code archive as an argument.' exit else #unpack the archive if [ -f $ARCH ] ; then mv -v $ARCH /tmp cd /tmp tar -xf $ARCH fi #compile and install the program CONT=$(tar -tf $ARCH) DIR=$(head -n 1 $CONT) "head -n 1 $CONT" if [ -e $DIR ] ; then cd "$DIR" if [ -x "configure" ] ; then "su" "./configure" "sh make" "sh checkinstall" "sh installpkg $CONT.tgz" exit else echo 'There is no configure file. This may not be a typical source code archive.' echo 'Try checking for a "readme","install" or other documentation in the archive' echo "Contents : \"$DIR\"" exit fi else echo 'This may not be a typical source code archive.' echo 'Try checking for a "readme","install" or other documentation in the archive' echo "Contents : \"$DIR\"" exit fi exit fi