No Linux distribution can bundle every package that users might want, so most distros host software repositories from which users can download and install additional applications. Since 2006 Slackbuilds.org has served as a high-quality repository for Slackware users, but using it requires several steps and switching between a Web browser and a virtual terminal. Sbopkg is a new ncurses-based utility that helps users build packages from SlackBuilds.org and seamlessly integrates the repository with the operating system.
Slackbuilds.org is closest thing available to an official Slackware repository. It is administered by people on the Slackware development team and recommended by Slackware's maintainer, Patrick Volkerding, in the Slackware release notes. Sbopkg automates and streamlines the process of working with Slackbuilds.org to build packages.
To understand how sbopkg works, it is necessary to understand Slackware packages and how Slackbuilds.org works.
How Slackware packages work
If Slackware Linux has one overriding philosophy, it is transparency to users. Slackware users expect to manually edit configuration files, compile software from source, and generally take a hands-on approach to administering their systems. Conversely, using a binary package that somebody else compiled means not knowing if they used the same libraries or versions of libraries that you have installed, and not having a chance to customize compile options.
Slackware can use binary packages, but they must follow certain standards so Slackware's package management tools can use them to upgrade or remove installed applications. Therefore, Slackware developers use SlackBuild scripts to automate the process of making packages.
Slackbuild scripts are shell scripts, usually run as root, that set up a temporary build directory; configure, compile, and install the software to that directory; then use Slackware's makepkg utility to create a package. Slackware packages are gzipped tar files. The SlackBuild scripts ensure that proper configuration and compilation options are used. Makepkg ensures that when Slackware's package utilities uncompress the files into the "/" directory tree, they go into the right places with the correct permissions.
Slackbuilds.org offers SlackBuild scripts and the associated ancillary files for applications not included in Slackware's official distribution. Its goal is to "have the largest collection of SlackBuild scripts available while still ensuring that they are of the highest quality." The list of available applications ranges from high-profile ones like OpenOffice.org to more than 200 individual libraries that are dependencies for other packages.
Using the site is straightforward but time-consuming. You can either browse the repository or search for a specific package. Each package has its own page on the site, with links for downloading the source file (which is hosted on its own site, not Slackbuilds.org), and a compressed file containing the SlackBuild script, a few text files providing information on the package, and sometimes another script to be run after installation. Building a package using SlackBuild scripts requires you to:
- Download the SlackBuild archive and extract it into its own folder.
- Download the source file and put it in the same folder.
- Edit the SlackBuild script if necessary.
- Execute the SlackBuild script as the root user. At the end of the process, the completed package will usually be in the /tmp directory.
- Install the package.
While this process is not onerous, it does require a lot of manual work. Building a single package this way may not take much time, but the time adds up quickly when you're building a complex package that also has a lot of dependencies that need to be built.
What Sbopkg does
Sbopkg streamlines the process, automating the package creation steps. To get started with sbopkg, download either the source file or the precompiled binary from the download page of the sbopkg Web site. Sbopkg's own SlackBuild script is included in the source file. As root, install the package, then edit the /etc/sbopkg/sbopkg.conf.new file. By default it has the following options:
# Optional - the $OUTPUT variable is used by SlackBuild scripts only
# and can be used to change the output location of compiled packages.
The default values should work well for most people. I uncommented the last line and changed the output directory from /tmp to another folder I use for packages I have built.
When you are done editing, save the file as /etc/sbopkg/sbopkg.conf. Still logged in as root, start sbopkg. You should see the main menu. Select the first menu item, Rsync, which downloads a local copy of the SlackBuilds.org repository. The repository takes 11MB of disk space -- a small amount of space for the ability to build more than 1,000 packages. With this one step, all of the SlackBuild scripts and associated files, though not the source files, are downloaded and ready for use.
Sbopkg's menu-driven interface makes browsing or searching the repository as easy as using the Web site. To build a package, first navigate to that package's menu. From that menu, you have the option to view the readme, .info, slack-desc file (a brief description of the package), and the SlackBuild script. The menu also has options for editing the SlackBuild script, deleting the edited script, and building the package. If you select the option to build the package, sbopkg downloads the source file, runs the SlackBuild script (using the edited version if one exists), and then offers to install the completed package -- three steps that have to be done manually without sbopkg.
Beyond building packages, the main menu offers other options for managing SlackBuilds.org packages:
- List installed SBo packages.
- List potential updates to installed SBo packages.
- View the contents of the cache directory (where source files are stored). After viewing, a second menu offers users an option to delete the source files.
- View the permanent build log (also offering a choice to delete the log).
Keeping track of the installed third-party Slackware packages and potential updates to them is a valuable feature. Sbopkg follows Slackware (and by extension, SlackBuilds.org) convention by not offering automatic dependency checking. However, the readme files for each of the packages list dependencies, and required libraries are available in the repository.
Sbopkg has a command-line interface too. Typing
sbopkg -h lists the command-line options. The CLI is nearly as easy to use as the menu-driven interface. For example, typing
sbopkg -s moria searches the repository for a string matching "moria." If it finds the package, it displays the readme file, .info file, slack-desc file, and SlackBuild script piped through more. Typing
sbopkg -b moria builds the package and asks if you want to install it.
Sbopkg performed nearly flawlessly in my testing. It successfully built everything I tried except for OpenOffice.org, and the problem with OpenOffice.org turned out to be a corrupt, incomplete download. If the source file is incomplete or corrupted, sbopkg fails to build the package, as it should. But I discovered a bug where sbopkg does not offer a way to clear the failed source file and try again. I reported this bug on the discussion list for sbopkg, and its author, Chess Griffin, worked to fix it immediately.
The only other hiccup I had was when I edited a SlackBuild script. I discovered that the editor defaults to vi. There is nothing wrong with vi, of course, but my fingers are used to Emacs, so I was momentarily nonplussed. The sbopkg man page anticipated my discomfort. It explains:
Certain features of sbopkg rely on outside binaries, such as a pager to view the text files when sbopkg is run from the command line, and an editor to edit the SlackBuild ... the edit SlackBuild function found when sbopkg is used with the dialog interface will look to $EDITOR and will default to 'vi' if no $EDITOR has been defined. If the user wants sbopkg to use another EDITOR, such as nano, then adding the requisite information in ~/.bashrc or other similar configuration file to export EDITOR will suffice.
export EDITOR='emacs -nw' to the .bashrc file for the root user changed sbopkg's behavior, though I would prefer that the $editor variable be set in /etc/sbopkg/sbopkg.conf rather than relying on a system-wide setting.
By integrating the SlackBuilds.org repository with the operating system, sbopkg greatly streamlines building and installing third-party Slackware packages. Sbopkg is actively developed, but it is stable, powerful, and exceptionally useful already.