-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
It's not a dim question, because it is a question that has plagued computing since around the time computers were sophisticated enough to multitask. Maybe even before that. I'll have a bit of a chat about it, then tell you how I deal with the problem you're having (or jush SKIP AHEAD TO UNTIL YOU SEE "CHROOT INSTALL")
Installation/Uninstallation is a question of choosing your own battles. You can't avoid any fight at all, but you can limit the problems you'll face to just the ones that you can control.
If your distribution has the program you want in its repository, use it. It's the least troublesome way to get what you want almost completely hassle-free. If it isn't in any repository for your distribution, follow the distribution's guide for making a package for the packaging system, or switch to another distribution that supports the program you want.
CAVEAT about checkinstall: its only as good as its authors can make it. It works some of the time, but I've never been able to rely on it to do the Right Thing® in all circumstances. Its better to learn to make packages the way your distribution's maintainers do it.
If you have to have software that you build yourself, then you have some options. First, stop thinking of installation as a magical process that has some hidden secret sauce that turns everything on. Installing a program is simply copying a collection of related files to the right places on a computer with the right file privileges. Even on Windows, programs do not necessarily have to dick around making registry entries and blah blah blah(vomit). Otherwise, notepad++, vlc, emacs, etc wouldn't just work when run off a flash drive. But enough ranting.
BUILDING THE KERNEL:
All you really need to install the kernel is the linux binary, the initrd file, and the system map IIRC, and modules (if you built any). It really isn't any harder to do then any other software unless you intend to do a custom configuration. In the simplest form, if you build your system drivers into the kernel you can configure, make, and just copy your linux binary to /boot then update grub and reboot. For a good guide on kernel building, see Linux from Scratch or DIY Linux.
USING "make uninstall":
Developers using the GNU build tools make Makefiles that help the program "make" to do the right things when building binaries from source code. Even some interpreted programs that do not require compilation use "make" to direct their installation. If the program you want to install has an "uninstall" rule, you can use it to uninstall after doing a "make install" with approximently the same confidence as you have in the sanity of the developer. If you aren't sure that the program comes with "make uninstall" and are frightened to install without one, then you could "./configure" the package and then try:
$ grep "uninstall" Makefile
It isn't foolproof, but its worth a look to see if grep finds anything. If not, don't rely on there being an uninstall rule. Sometimes there is an uninstall which won't be apparent in any other way until after you've gone out on a limb and did the install. Anyway, if you know there is an uninstall rule, you can use it. If you want something that gives you a little more control, and you don't mind a little more work, then try:
CHROOT INSTALL
The funny thing is that we are not actually going to invoke "chroot". There are ways we aren't going to cover and don't need to worry about to do builds inside an actual chroot. But for now, in this guide, all chroot means is that we are going to trick "make" into thinking your root "/" is elsewhere, thus controlling where the files get deposited. You do this by setting the environment variable DESTDIR to the name of another directory into which you wish your compiled files to go.
CAVEAT: Not all packages that use GNU make will use or respect the DESTDIR variable (eg. glibc). In some cases you will need to do a little investigating to be sure what environment variable your package's Makedfile respects. In extreme cases, you may need to hand edit a Makefile to force this behavior. But 99.9% of the time DESTDIR works. Non GNU build systems probably do everything differently, so don't assume anything here will work with those. Check google for Linux from Scratch or DIY Linux. They might have pointers for build systems other then GNU's.
Its very easy. Configure and build in the usual way from the top level of your source code directory:
# configure and make the package
# you could run this exactly as typed (if you have no custom flags you want to pass to "make")
$ ./configure; make
When its finished building, as your normal unpriviledged user:
# install everything in an alternative location
# CAVEAT; do not run this as written here. read on to
# learn which bits to change before issuing the command
$ make DESTDIR=/home/$USER/<my good directory>/package-name$( date +%Y%m%d ) install
where you will replace <my good directory> with path name that exists and is writable, AND package-name with a real name for the software you are building. The "package-name$( date +%Y%m%d)" in that command will get "make" to make a directory with a name and a date stamp. GNU make will slurp up all the stuff that "make install" wants and then drop it into the <my good directory>/package-name$( date +%Y%m%d ) directory. Throughout this guide, I will refer to these locations as written in the example command, although they will have different unique names on your system. Inside the "package-name$( date +%Y%m%d)" directory are all the files for your program, arranged neatly in the order they are meant to exist from root "/". You can install the package by "cd" to <my good directory>/package-name$( date +%F), and then
# install from uncompressed chroot directory
# you can run this exactly as typed
$ tar cf - * | ( cd /; sudo tar xf - )
which will copy everything under your chroot directory to your real root. Most of the time this is perfectly safe. At least as safe as the sanity of the developer. Later you can uninstall the package by "cd" to <my good directory>/package-name$( date +%Y%m%d ) and doing:
# uninstall from uncompressed chroot directory
# you can run this exactly as typed
$ find * -type f | while read i; do sudo rm -v /"${i}"; done
CAVEAT: mistyping this command can destroy your entire system!!! NEVER EVER "rm -R" HERE. NOT EVER!
Of course, keeping the entire build in two places is a waste of disk. I usually make tarballs. To do it just "cd" into <my good directory>/package-name$( date +%Y%m%d ) and:
# compress chroot directory into an xz'd tarball\
# change "package-name$( date +%Y%m%d ).tar.xz" to the real
# name of your tarball before issuing the command
$ tar cf - * | xz -c9 >../package-name$( date +%Y%m%d ).tar.xz
CAVEAT: Its important to remember to tar from _inside_ the "package-name$( date +%Y%m%d )" directory. Otherwise, if you tarred it up with "package-name$( date +%Y%m%d )" as the tarball root, it wouldn't work the way you'd expect if you tried to install or uninstall from it.
Now you should have the file "package-name$( date +%Y%m%d ).tar.xz" in your <my good directory>. You can use this file to install/uninstall the software so you can delete the package-name$( date +%Y%m%d ) directory. To install from tarball, "cd" to your root "/" path and
# install package from tarball
# change <my good directory> to the real path name you installed into
# change "package-name$( date +%Y%m%d ).tar.xz" to the real tarball file name
$ sudo tar xf /home/$USER/<my good directory>/package-name$( date +%Y%m%d ).tar.xz
# uninstall package from tarball
# change <my good directory> to the real path name you installed into
# change "package-name$( date +%Y%m%d ).tar.xz" to the real tarball file name
$ sudo tar tf /home/$USER/<my good directory>/package-name$( date +%Y%m%d ).tar.xz | while read i; do rm -v /"${i}"; done
CAVEAT: mistyping this command can destroy your entire system!!! NEVER EVER "rm -R" HERE. NOT EVER!
Take this for all in all, it was but a guide. Hopefully, we will never see its like again ;)
Regards,
Bryan
Post by Robin Paulsonthis seems like a really dim question, but i can't begin to think of
how i might do it.
let's say i download a package in source form, and then use configure,
make, make install to install it. how do i uninstall it? it's not in
deb/rpm/whatever form, so i can't use apt/the red hat thingy to remove
it
deleting the files seems clumsy and ignores undoing any scripted steps
carried out during the install
what if i installed a kernel - is it as simple as editing the grub cfg files?
cheers
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJNQ0YNAAoJEHblvm1J+WqMtjcH/RwrhlPgOpOQ3u8IjjzyatI5
pHrF+yDA3l92S4SZzX4EqoH9YmjC+J8gZ4u93qA4F7SoZ6IAxeIqVrano1yrtt7B
UXd/pAv9IbmH6KWLvjPM5SEGLyRrEH8P6ep1ZN/hDDLOlT/KDDLEWhNiXqTmWHsP
7F/dBtHoxUSpMUy88bLaxp9OE09lK6DPh4V2kfwYr7vDt2Z05mCjb/t1w3VA/+7p
2ZavUv9aP90XaAj7CRod5fstxJahGXrnvTjzPQD7iFQm0VCwiZXvKid8w4AtevFi
K9qwmFaRuwiwOvc/puFdB+yBT4CRwrNiiLuOi1YmaOL0mI7K6tDCwDr+qkoCURw=
=7Arq
-----END PGP SIGNATURE-----
_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug