April 23, 2008

Installing and tracking software updates with toast

Author: Ben Martin

Using toast takes the burden out of building, installing, and keeping track of software built from source. You can use toast to build and maintain software installed in your /home directory as a regular user, or to set up software for all users in /usr/local. toast can obtain packages over HTTP, HTTPS, FTP, and via SSH and CVS. It can handle most archive formats, as well as .rpm and .deb packages.

For toast itself, no packages exist for Ubuntu, Fedora, or openSUSE. Its main requirement is Perl. You can either download the uncompressed Perl script and shove it into your $PATH to install it with default settings, or use toast to install itself, either inside your home directory, if you are the only user who is going to use toast, or system-wide to allow all users to use the same toast. Using toast to install itself into your home directory is shown below. If you need to use a Web proxy to download files you need to set the environment variable in order for toast to install itself.

$ export http_proxy=http://hostname.example.com:port/
$ wget -O- http://toastball.net/toast/toast|perl -x - arm toast

When you install toast as a user, it will maintain its packages inside $HOME/.toast. The toast tool itself will reside in $HOME/.toast/armed/bin. Instead of placing this armed/bin directory into your path, you should invoke toast with its env command to get output that also sets manual, info, header file, and library paths to also include the software that you have installed with toast into your home directory.

You are likely to want to invoke toast env every time you boot up so that software installed with toast can be used without needing to explicitly modify your environment. The first command below shows you what environment variables are modified. The second command alters the bashrc to set up toast for new shells by calling eval to set these environment variables instead of printing them to the screen.

$ $HOME/.toast/armed/bin/toast env
XML_CATALOG_FILES='/home/saru/.toast/armed/etc/xml/toast-xml-catalog /etc/xml/toast-xml-catalog';

$ echo 'eval `$HOME/.toast/armed/bin/toast env` ' >> ~/.bashrc

See the toast manual for directions on system-wide installation of toast. I ran into issues with directory permissions when I tried to invoke toast as a regular user when toast itself was installed system-wide, so I used version 1.453 of toast installed as user ben.

The toast command is aware of many of the source repositories and metadata Web sites for open source software. For example, if you want to install the sshfs FUSE filesystem, you do not have to download the tarball first. toast's find command will show you if the software can see an application, where it thinks it can download it from, and what versions are available -- but you must know the correct package name. For instance, in the case of sshfs, the freshmeat.net project name of the software is sshfs-fuse. Once I knew that toast could find the package, I used the arm command to download, build, install, and create softlinks to the package.

$ toast find sshfs
can't find sshfs
$ toast find sshfs-fuse
version 1.7: found
version 1.8: found
version 1.9: found

$ toast arm sshfs-fuse
mkdir /home/ben/.toast/pkg/sshfs-fuse
mkdir /home/ben/.toast/pkg/sshfs-fuse/v1.9
# creating /home/ben/.toast/pkg/sshfs-fuse/v1.9/archive.tmp/sshfs-fuse-1.9.tar.gz
# fetching http://downloads.sourceforge.net/fuse/sshfs-fuse-1.9.tar.gz?modtime=1197...
export LD_PRELOAD=/home/ben/.toast/pkg/sshfs-fuse/v1.9/1/helpers/rewrite.so
(cd /home/ben/.toast/pkg/sshfs-fuse/v1.9/1/src/sshfs-fuse-1.9; ./configure --prefix=/home/ben/.toast/armed)
checking for a BSD-compatible install... /home/ben/.toast/pkg/sshfs-fuse/v1.9/1/helpers/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
$ ls -lh ~/.toast/armed/bin
lrwxrwxrwx 1 ben ben 53 2008-04-07 09:40 sshfs -> /home/ben/.toast/pkg/sshfs-fuse/v1.9/1/root/bin/sshfs*
lrwxrwxrwx 1 ben ben 50 2008-04-07 09:37 toast -> /home/ben/.toast/pkg/toast/v1.454/1/root/bin/toast*

One major advantage of using toast to perform the installation is that it tracks what you have installed and can update any software that it installed. You can get the status of any package with the status command and update any installed package with the upgrade command. If you provide no package name to either of these commands then toast will perform the operation on all packages.

$ toast status
version 1.9: stored
build 1: armed
version 1.454: stored
build 1: armed

$ toast upgrade
# fetching http://downloads.sourceforge.net/fuse/
# fetching http://sourceforge.net/projects/fuse/files
# fetching http://sourceforge.net/project/showfiles.php?group_id=121684
sshfs-fuse version 1.9 appears to be the latest available version
[/home/ben/.toast/armed/bin/toast: 4787/5855/5855/5872/5880/6718 v1.454]

Special considerations

When a build does not follow the normal ./configure; make; make install procedure, you have to step in to make toast work. As an example, consider the archivemount tool. This program is not listed on freshmeat.net, so the first thing to do is use the add command to tell toast where to find archivemount. The project's Web page just lists a bunch of tarballs. Trying to install archivemount with toast will fail because you can't execute make install for the software.

$ toast add http://www.cybernoia.de/software/archivemount
$ toast install archivemount
# fetching http://www.cybernoia.de/software/archivemount
# fetching http://www.cybernoia.de/software/archivemount/
rm -f /home/ben/.toast/pkg/archivemount/vunknown/archive.tmp/archivemount
# creating /home/ben/.toast/pkg/archivemount/vunknown/archive.tmp/archivemount-0.5.3.tar.gz
# fetching http://www.cybernoia.de/software/archivemount/archivemount-0.5.3.tar.gz
(cd /home/ben/.toast/pkg/archivemount/vunknown/1/src/archivemount-0.5.3; make install)
make: *** No rule to make target `install'. Stop.
make install returned 512

The quickest way to get around this is to create a patch that adds an install target, and tell toast about the patch when you invoke the toast arm command. With the patch included as part of the sources to the arm command, the build, installation, and softlinking is performed and everything completes successfully. After the installation the status command shows that toast is aware that the installation of archivemount was patched and records where the patch came from. This comes in handy when a new version of archivemount is released.

$ cd /home/ben/.toast/pkg/archivemount/v0.5.3/1/src/archivemount-0.5.3
$ cd ..
$ mkdir archivemount-0.5.3.me
$ cp archivemount-0.5.3/Makefile archivemount-0.5.3.me/
$ vi archivemount-0.5.3.me/Makefile
$ diff -Nuar archivemount-0.5.3/Makefile archivemount-0.5.3.me
--- archivemount-0.5.3/Makefile 2006-12-29 01:32:47.000000000 +1000
+++ archivemount-0.5.3.me/Makefile 2008-04-07 10:35:13.000000000 +1000
@@ -49,3 +49,5 @@
.PHONY: all test clean dist

+ install --mode 555 archivemount /usr/local/bin

$ diff -Nuar archivemount-0.5.3/Makefile archivemount-0.5.3.me >| /home/ben/.toast/archivemount-makefile.patch
$ toast clean archivemount
$ toast arm archivemount/0.5.3: \
[ http://www.cybernoia.de/software/archivemount/archivemount-0.5.3.tar.gz \
~/.toast/archivemount-makefile.patch ]
$ toast status
version 0.5.3: stored
build 1: armed

With toast, installing new or esoteric software is a fairly quick and easy task. If a project is listed on freshmeat.net, you can just feed the project name into toast and if all goes well have the latest version of that package downloaded, compiled, and installed for your personal use with minimal interaction. A major advantage of using toast is having it track what it installed so you can easily monitor and update your software.


  • System Administration
  • Tools & Utilities
Click Here!