Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One of the things I love about the Debian ecosystem is that there's a tool that's even better than what this post recommends. Debian update-alternatives, available on any Debian-derived distro.

update-alternatives allows you to compile or unzip software to somewhere obscure and safe, like /opt, then soft-link it to /usr/local with update-alternatives --install. The benefits:

1. You can slave all dependencies to the main binary, so that they can all be removed with update-alternatives --remove.

2. You can install multiple versions simultaneously (including the system version), flag one as active, and toggle between them easily with update-alternatives --config.

3. #2 lets you upgrade to a new version (say of Java, Scala, Haskell, whatever) without uninstalling or overwriting the current version, and if the new version breaks your app you can toggle back to the known working version with a quick update-alternatives --config.

4. Keep all the files together in their own directory, like /opt/java/jdk/1.7.0_07, instead of strewn all across /usr/local, /usr/bin, /usr/lib, /usr/share, etc. Soft link them instead into their appropriate locations.

I created update-alternatives install scripts for Haskell Platform [1], Java [2], and Scala [3] for anyone interested in seeing more how it works.

[1]: https://github.com/byrongibson/scripts/tree/master/install/h...

[2]: https://github.com/byrongibson/scripts/tree/master/install/j...

[3]: https://github.com/byrongibson/scripts/tree/master/install/s...



I remember seeing a different tool which takes care of all that for you so you don't have to write scripts, but I forget its name now. It's definitely a good idea (slotting software installs) but it needs more automation.


I only use the scripts to slave all the dependent binaries to the main binary. If you only have one binary, it's just a single line. (I also script literally everything, even single-liners).

I don't know if there's any way to do something like that without update-alternatives or your tool having some built-in awareness of the package's dependencies, but that's not really possible for a tool designed to be able to handle literally any arbitrary, user-compiled/installed package. Otherwise you get the system package manager again.


The tool I remember would basically do the equivalent of:

  for file in `find /opt/package_name/version/` ; do
      NEW=`echo $file | sed -e "s/^\/opt\/package_name\/version\//"`
      ln -s $file /usr/local/$NEW
  done
Where the base files are installed in /opt/package_name/version/ and all of them are symlinked into /usr/local/ by default with the option of changing individual file links. This way you change the entire 'installed' version of a package without needing application-specific path modifiers. But you can still build applications against specific versioned directories (if you have an app which requires BerkeleyDB 4.1 which conflicts with 4.0, for example)

(You can automate that for a pre-existing package if it's got relocatable code, but hardly as reliable as building it from scratch for the versioned directory and changing symlinks in /usr/local)


You may be referring to paco[1], which has always been kind of a hack. It also appears to not have been updated in a very long time.

1: http://paco.sourceforge.net/


Possibly... I don't remember the tool I saw using an LD_PRELOAD, and I think it operated on post-make-install files (like a DESTDIR staging directory).

Anyway, the mini script I provided below is like half the functionality you would need after the source is compiled to a PREFIX of /opt/package/version/. Perhaps i'll write a tool when I get bored :-) The tool and method i'm borrowing from a proprietary tool I saw once, but obviously other people have implemented it too.

Paco has a great idea though, and that's a meta-format and wrapper for different system packages. If you have to support five different production operating systems and the same software on all of them, switching between package managers is a pain in the ass. An extra tool to cross-reference paco to the OS's packages could make it really handy for resolving software updates in a unified way.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: