lnbin
This is my lnbin script.
This is a program for managing symlink in a /usr/local/bin
directory. It is similar to stow, lndir, cleanlinks and
others.
The approach used by lnbin is based on Stow, and it is to install each into its own tree, then use symbolic links to make its bin directory, so that the command can be in the executable path.
When run, lnbin examines packages in pkgs-dir
and the
target
directory (see OPTIONS), adding or removing links as
needed.
Sample usage:
pkg installation
The standard way to use lnbin is:
- download source package
- build and install package
# extract archive
tar zxvf archive-x.x.tar.gz
cd archive-x.x
# GNU autoconf
./configure --prefix="/usr/local/pkgs/archive-x.x"
make
# Package installation
make install
# ... or ...
make install DESTDIR=/usr/local/pkgs/archive-x.x
- update symlinks in /usr/local/bin
cd /usr/local/bin
lnbin -v -x ../pkgs
This will add the new links (and also remove/update obsolete/changed links)
Removing packages
rm -rf /usr/local/pkgs/archive-x.x
cd /usr/local/bin
lnbin -v -x ../pkgs
Updating symlinks (after upgrade)
cd /usr/local/bin
lnbin -v -x ../pkgs
This will add new links and/or remove obsolete links
Handling additional files
For packages that install additional files like man pages or desktop files you can use the commands:
lnbin -v -x -s share/man/man1 -t /usr/local/share/man/man1 ../../../pkgs
lnbin -v -x -s share/applications -t /usr/local/share/applications ../../pkgs
References
There are a number of packages that do similar things. The main
attractiveness of this one is that it is a /bin/sh
script
intended to have low dependancies.
Other options:
- stow: a perl program
- spill: written C, so also has a low dependency count.
- stash: a package manager for non-root users (in perl)
- lt: shell script by Marc Vertes.
I chose not to use lt because while written in /bin/sh
, I wanted
a script that could use relative links instead of absolute links.