Do you install software manually without using your system's package management tools (i.e. yum or apt-get)? Do you like testing different versions of a particular program and want to be able to switch from one to another? Stow is what you need. Stow is a Perl program that helps me manage manual software installations. Instead of installing into the /usr/local directory tree, I configure my software so that it installs into /usr/local/stow/program-0.1, where program is the name of a package and 0.1 is its version number. For example, upon configuring the latest version of Unbound, I ran these commands:

./configure --prefix=/usr/local/stow/unbound-1.4.7 
    make
    make install

The install step then creates a directory tree containing bin, sbin, etc, and whatever else is required and populates the directories accordingly. To "activate" this package, when I then do is to tell stow to do just that. Invoke stow with an option instructing it into which directory tree to install to:

cd /usr/local/stow
    stow -t /usr/local  unbound-1.4.7
    
    ls -l /usr/local/sbin/unbound
    lrwxr-xr-x  1 root  wheel  34 Nov 24 20:08 /usr/local/sbin/unbound -> ../stow/unbound-1.4.7/sbin/unbound

Note how the resulting file is a symbolic link to the original. I can also "delete" the package, well the symlinks, from /usr/local with an invocation of stow with the -D option. (Option -v shows us what stow is doing.)

stow  -v -D -t /usr/local unbound-1.4.7
    UNLINK /usr/local/etc/unbound
    UNLINK /usr/local/include/unbound.h
    UNLINK /usr/local/lib/libunbound.2.dylib
    UNLINK /usr/local/lib/libunbound.a
    UNLINK /usr/local/lib/libunbound.dylib
    UNLINK /usr/local/lib/libunbound.la
    UNLINK /usr/local/sbin/unbound
    UNLINK /usr/local/sbin/unbound-anchor
    UNLINK /usr/local/sbin/unbound-checkconf
    UNLINK /usr/local/sbin/unbound-control
    UNLINK /usr/local/sbin/unbound-control-setup
    UNLINK /usr/local/sbin/unbound-host
    UNLINK /usr/local/share/man/man1/unbound-host.1
    UNLINK /usr/local/share/man/man3/libunbound.3
    UNLINK /usr/local/share/man/man5/unbound.conf.5
    UNLINK /usr/local/share/man/man8/unbound-anchor.8
    UNLINK /usr/local/share/man/man8/unbound-checkconf.8
    UNLINK /usr/local/share/man/man8/unbound-control.8
    UNLINK /usr/local/share/man/man8/unbound.8

Very practical indeed, and I recommend you have a closer look at this program. Start with its manual. Stow is ideal for programs installed directly from tarballs, instead of standard packaging formats.

Flattr this
CLI and package :: 24 Nov 2010 :: e-mail

Comments

blog comments powered by Disqus