This script uses installwatch to create packages in the case where DESTDIR or similar is not available. Simply invoke the script followed by 'make install"
/tmp/installscript make install
And it will do it's thing. The file is commented with what can be changed and what does what.
Requires tar.tcz and checkinstall-tc.tcz
#!/bin/sh
# Installwatch parsing routines taken from Lunar Linux and Checkinstall to
# create file lists and/or packages from 'make install'.
. /etc/init.d/tc-functions
if [ ! -f /usr/local/tce.installed/tar ]; then
echo "${RED}You need to install tar.tcz. Exiting..${NORMAL}"
exit 1
fi
if [ ! -f /usr/local/tce.installed/checkinstall-tc ]; then
echo "${RED}You need to install checkinstall-tc.tcz. Exiting..${NORMAL}"
exit 1
fi
######## SET THESE VARIABLES IF DESIRED.
WORKPATH=/tmp # a directory will be created in this path using the $PWD where the script
# was run, and will be where the files and package will reside. It is
# named using the $PWD to seperate the results of different package builds.
INSTALLWATCHLOGPATH=/tmp # Location of installwatch files, not important per se.
PACKAGE=YES ## YES creates a tarball of the package in $WORKPATH, leave blank to not.
COMMAND="${*##${0}}" # Uses the command invoked after this script, can hardcode to 'make install' if desired.
BASEDIR="$WORKPATH"/`basename "$PWD"` # The actual directory where the results will reside.
# Adjust WORKPATH for the desired location.
########
[ -d "$INSTALLWATCHLOGPATH" ] || mkdir "$INSTALLWATCHLOGPATH"
[ -d "$BASEDIR" ] || mkdir -p "$BASEDIR"
> "$INSTALLWATCHLOGPATH"/logfile
installwatch -r "$INSTALLWATCHLOGPATH" ${COMMAND}
cd "$BASEDIR"
EXCLUDE="(^/dev|^/tmp|^$BASEDIR|^/mnt|^/home|^/proc|^/sys)"
parse_file() {
cat "$INSTALLWATCHLOGPATH"/logfile | egrep -v '^[-0-9][0-9]*[[:space:]]*(unlink|access|rename)' | cut -f 3 | egrep -v "$EXCLUDE" | grep "^/"
cat "$INSTALLWATCHLOGPATH"/logfile | cut -f 4 | egrep -v "$EXCLUDE" | grep "^/"
}
existing(){
while read FILE ; do
if [ -e "$FILE" ] ; then
echo "$FILE"
fi
done
}
parse_file | sort | uniq | existing > filelist
sed -i 's:^/::g' filelist
PKGNAME=`basename "$PWD"`
if [ "$PACKAGE" == "YES" ]; then
sed -i 's:^/::g' filelist
cd /
echo "${YELLOW}Tarring files to ${GREEN}"$BASEDIR"/package-"$PKGNAME".tar.gz${NORMAL}"
tar --no-recursion -T "$BASEDIR"/filelist -cpzf "$BASEDIR"/package-"$PKGNAME".tar.gz
fi
# Unpack package if desired to directory with the command:
# tar xvf package-(name).tar.gz -C /desired/directory