[TriLUG] package management pitfalls

Thomas Gardner tmg at pobox.com
Thu Nov 1 08:06:03 EDT 2012


On 10/30/12, Brandon Van Every <bvanevery at gmail.com> wrote:
> [...]
> whistles?  And if I change my mind about the source code install, will
> it uninstall gracefully?

This is a little off the beaten path for this topic, but I thought I'd
take the opportunity to mention how I handle this, in case it's useful
to someone.  In fact, I just did it with FVWM, so I'll use that as an
example.  It's a little painful, but if you really want the SW, really
want to keep things clean, ensure your ability to upgrade later, and
ensure your ability to remove it if it causes trouble, and can't get
to a pre-packaged version of whatever it is you're looking for, it can
be worth the effort.

After getting the source from the maintainer (in my case
fvwm-2.6.5.tar.bz2 from http://www.fvwm.org/) and unpackaging it,
several iterations of ./configure and installing various other
development packages that I could get to, I had something that could
be built.  I told configure to use /opt/fvwm-2.6.5 as the ``prefix''
path (the base dir for installation, defaults to /usr/local on this
and most pieces of SW).  The configure script is common, but not
universal.  None the less, there's usually a way to override the
default installation path.  Read the build and install instructions.

All the above is done as a mere mortal lUser.  Now as root, I just
create this directory in /opt and give ownership of it to the mere
mortal lUser who is doing the build.  Now I follow the instructions to
build and install as the mere mortal lUser, confident that nothing
will be installed anywhere naughty on the system (because this lUser
can't write to that many places), and that it is easily removable and
upgradable (more on that later).

Now, as root, I create a symlink called /opt/fvwm that points to
/opt/fvwm-2.6.5 (why later).  Also as root, I look through this new
directory and put down symlinks in obvious places (like ln -s
/opt/fvwm/bin/* /usr/local/bin and suchlike).  There usually isn't
much to link into places where you can find it without having to mess
with your $PATH and such.  Be careful to always point your links into
/opt/fvwm, not /opt/fvwm-2.6.5 (or whatever the version is).  This
allows for safer and easier upgrades:  In the future, if you want to
try a newer version for whatever reason, go through the steps above to
build and install the newer version in its own directory in /opt named
after the new version number, point the /opt/fvwm symlink to the new
version directory and give it a whirl.  If it doesn't work, all you
have to do to revert is point that symlink back to the previous
version.  Since all the links on your system follow that generic link
with no version in its name, switching versions is as easy as pointing
that symlink to to the right version directory.  When you're convinced
the new version is what you want, you can just remove the old version
from /opt and it'll be nothing but a fond memory.

In my case, since the mere mortal lUser I used to do the build and
install is also an actual lUser of the system (i.e. not a special
lUser reserved just for this purpose, but my own account), I also
changed the owner of everything under the /opt/fvwm-2.6.5 directory to
root so that the mere mortal lUser doesn't accidentally mess something
up in there the next time he does something stupid.  If I were smart,
I might come up with a scheme involving a special account (like opt)
for such stuff, but then, nobody has ever accused me of being smart.

To remove, well unless you're running a pretty sloppy system, you're
pretty well guaranteed that everything got installed into that magic
directory in /opt because (presumably) your mere mortal lUser didn't
have permission to install anywhere else.  Just remove that directory.
 You can hunt down those symlinks you put down everywhere easily
enough with the find command and remove them, and it's gone.  Also, if
a package ever does become available for this and you'd like to
install it, it would probably be wise to find and remove all those
symlinks before installing.

It sounds worse than it is.  It's usually harder to get the thing to
configure and build than it is to do all the other stuff, and if
you're going to go the build from source route, you're going to have
to do that no matter what.  After that, the rest is actually pretty
easy, and gives you some assurance that you can keep your system
fairly clean.

Welcome to my anal-retentive little world....

L8r,
tg.



More information about the TriLUG mailing list