by Lovechild
(Transferred from Wiki by Peter)

Revision history:

1.0 - Official release
1.1 - Fixed the script, forgot to include the end fi's
1.2 - Ftrace changed URL - Thank you Dunbar for pointing that out

So, you have you brand new LFS system running, and now you are wondering - how do I get about installing software and/or removing it easily since we don't have any package management. The answer is to use a program called ftrace (a clone of the populare installwatch). You can get it here http://freshmeat.net/releases/8359/ , if the link is dead, check with Freshmeat. This program however won't compile or even work on our standard LFS system.

So you will need to issue a: chgrp root /usr/bin/make

and edit the ftrace.c file with your favorite editor (it's in the ftrace source dir.) and replace

Code:
#if (defined(LINUX_GLIBC) || defined(SOLARIS_LIBC))
lib = RTLD_NEXT;
#else
lib = dlopen("/lib/libc.so.5", RTLD_LAZY);
with:

Code:
#if (defined(LINUX_GLIBC) || defined(SOLARIS_LIBC))
lib = dlopen("/lib/libc.so.6", RTLD_LAZY);
#else
lib = dlopen("/lib/libc.so.6", RTLD_LAZY);
Now compile the software with ./configure && make && make install as usual.

now we make some logging directories for keeping track of software.

Code:
mkdir /var/install
mkdir /var/uninstall
Now whenever you install some software from source, issue the command:

Code:
./configure && make && ftrace -i /var/install \
/programname-version make install
which will make ftrace log the files that are installed by the command make install, and place the log in /var/install.

Now to remove some stuff we need a neat script which a friend of mine and former member of this forum (Ralinx) wrote:

Code:
#! /bin/bash

if [ "$1" == "" ]
then
echo "Usage: $0 <ftrace_logfile>"
exit 1
else
if [ $UID -eq "0" ]
then
echo "Removing $1..."
echo "Uninstalling $1..." > /var/uninstall/$1
echo "These files were removed:" >> /var/uninstall/$1
for a in `cat /var/install/$1`
do
echo $a >> /var/uninstall/$1
rm -rf $a
done
echo "Finished"
echo "Check /var/uninstall/$1 to see which files were deleted"
rm -rf /var/install/$1
else
echo "only root can execute this script"
exit 1
fi
fi
Save this as /usr/local/bin/nuke

Code:
chmod +x /usr/local/bin
Now to uninstall stuff, run:

Code:
nuke programname-version
The script will log which files are removed in the /var/uninstall/ dir. for troubleshooting.

Now wasn't that easy ?

Kudos going to: Ralinx (Davy Brion) for writing the nuke script.