Linkstall is a small program to simplify life on Unix-like systems where the administrator likes to install programs into their own separate directories. This can often be convenient, especially if they compile, install and uninstall new software packages often. Usually one might manage search paths for binaries, dynamic libraries or man pages with the environment variables PATH, LD_LIBRARY_PATH, PKG_CONFIG_PATH and MANPATH, or configuration files for man and the dynamic linker. When more and more optional packages get installed, these paths often get very long and cluttered, slowing the system a bit. Also, relying permanently on the environment variable LD_LIBRARY_PATH is not recommended. Linkstall attempts to be a solution for this kind of a situation. It installs directory trees using links (symbolic or hard links), and is also able to clean up after itself, when the administrator wants to uninstall a program.

Example of use:

A system administrator wants to check out a new version of a program, foo-1.23, but doesn't want to install it permanently just yet, so he installs it under /opt/foo-1.23, so he can see what files it installed etc. However, foo is a relatively complex program and has plenty of man and info pages and shared libraries, so configuring all these into the system is tedious, especially since he only wishes to try it out for a while. He decides to use linkstall, but is new to it and a bit suspicious of what it does, he first runs
linkstall -d -v /usr/local /opt/foo-1.23
and gets a list of what was (supposedly) done, with a dry-run mode on, so nothing was really done yet.
Everything looked ok, so he does the real thing this time with
linkstall -v -m /usr/local /opt/foo-1.23
This time he used the -m option because the dry run complained about him not having /usr/share/aclocal.
The admin plays with his new foo-1.23 and decides he doesn't want it, so he does
linkstall -u -v /usr/local /opt/foo-1.23
rm -Rf /opt/foo-1.23
and he no longer has any trace of foo-1.23 on his system, except the sources or installation package.
Without linkstall he would have had to edit his environment variables, or make links to foo-1.23 by hand, and remove all afterwards.

Linkstall installs a link to the target directory to point to each file or directory of the source directory, which has not been mentioned in its configuration file to be a common directory not to be linked. The uninstall mode inspects the target directory, and removes from there all such links that link to the given source directory or its contents. This approach allows one to install a program to its own separate subdirectory, and still use it without having to touch path variables or linker configuration. Installation and uninstallation can be done with a single command.

The approach must be considered experimental, and I am interested in comments and critique about the possible pitfalls it might have. In practice the system has worked well, but I may have just been lucky, and avoided any possible hidden problems by chance. You may send any comments you have to the email address linkstall(at)
Please be constructive. If you manage to mess up your filesystem with this program, I can only say, you have been warned beforehand!

The optional use of hard links is based on that links pointing to the same file point to the same inode number, and that this inode number cannot exist in other files. Hard links would be a more resource efficient method compared to symbolic links, but compatibility problems are possible. I don't have a deep enough knowledge of file systems to be sure that the principle is sound in every case. In practical tests with ext2 file system the idea worked, but comments are welcome.

Please read the included documentation and especially the warnings in it before installing and using linkstall.
Warning: Careless ( or even careful! ) use of this program may seriously mess up your operating system's file structure.


Jussi Nikula, Typotor Oy, 9.5.2008