Angel Tsankov wrote:
Really simple way:
Run ./configure and make as usual, but don't make install yet.
Run touch /baseline (any file works) to set a baseline date.
Run make install.
Run find / -cnewer /baseline | sed -e '/^\/proc/d' -e '^\/sys/d' >
/packagename.txt . This will show all of the files that were updated
in the make install.
Then you can just run rm `cat /packagename.txt` to remove the package.
Hmm, this seams a very neat solution, but one need to be very careful when
applying it in a multi-user environment (even in a multi-process one), so
that files modified between 'make install' and 'find' do not get
accidentally deleted. These could be user files (ones owned by non-root
users) or even configuration or log files of other programs already
installed and running on the target system.
Indeed, you have well understood the limitations of this method.
That's why you should check the contents of /packagename.txt well
before doing the rm! In your chroot environment while building
LFS, you should be quite free from the concurrency effect.
Also, you can exclude certain directories like /home and /var/log.
Watch out particularly for shared config files and the like. If the
make install created a new user for example, the above method
will zap your entire /etc/passwd!
A more common example is the installation of packages with texinfo
pages, which add entries to the top level info directory node. Again,
the above method will zap /usr/share/info/dir. You can deal with that
by the following technique:
DIRFILE=`grep "info/dir" /packagename.txt`
install-info --dir-file=$DIRFILE --delete \
`grep "info/.*\.info.*" /packagename.txt`
(Don't forget to remove the $DIRFILE line from /packagename.txt
before the rm!)
A safer approach is to install into a temp dir and then roll that up into
a tarball. It usually goes something like this:
DESTDIR=/tmp/packagename
mkdir $DESTDIR
make DESTDIR=$DESTDIR install
cd $DESTDIR
tar -czf /packagename.tar.gz .
To install:
cd /
tar -xzf /packagename.tar.gz
To uninstall:
cd /
tar -tzf /packagename.tar.gz | grep -v '/$' |xargs rm -vf
With this approach, you still have to be careful of the type of
problem I described above with info/dir. It is also better to script
the symlinks rather than to let tar handle them. So there are
several things to watch out for but there are solutions for all of
them and they can all be scripted--once you have done that,
you will have written your own basic package management tool!
B.
--
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page