Using slackpkg templates with sbodeps

30 March 2024

This page is under construction

This document describes how to use sbodeps to generate build queues for sbopkg. These queues can then be used with slackpkg as templates. This combination allows for consistent installation of SlackBuilds.org packages across multiple systems in cases where the target package requires one or more dependencies. In effect, the templates provide a meta package.

Disclaimer

Use this information at your own risk. No warranty is expressed or implied.
Slackware is a registered trademark of Slackware Linux, Inc..

Contents

Building Packages

This process relies on a set of packages compiled from the SlackBuilds.org project. Additionally, you will need McDutchie's heretical sbodeps utility. Finally, Slackpkg+ is used to install from a local repository.

Optionally, it may be helpful to run a virtual machine for the purposes of building packages. This allows for a clean Slackware installation against which specific queues can be built.

Local Repository

Setup a repository to publish built packages for slackpkg+. Slackpkg+ provides for unsigned repositories using filedir:///, httpdir:///, or ftpdir:/// URLs. For purposes of this guide, we'll use filedir://home/localrepo/. Adjust the subdirectory name(s) to match the versions for which you will build packages.

If you will distribute these packages to multiple machines (the point of this entire exercise) the repository will need to be available to each computer. You can do this by running an HTTP or FTP server, by export the file system via NFS, or copying the contents of the repository to each computer.

        # mkdir -p /home/localrepo/15.0
        # touch /home/localrepo/15.0/{FILE_LIST,CHECKSUMS.md5}
        

Configure slackpkg+ to use this newly created repository. Add this line to /etc/slackpkg/slackpkgplus.conf. Adjust the repository path in MIRRORPLUS to match the version of Slackware for which you will build packages.

        MIRRORPLUS['localrepo']=filedir://home/localrepo/15.0
    
Find the REPOPLUS line. Add _localrepo_ to the list of sources such that the line look similar to
        REPOPLUS=( slackpkgplus localrepo )
    
Your installation may include additional repositories in this list.

Working With Templates

Use _sbodeps -a_ to generate a build queue for a given package. Copy the resulting list to _/var/lib/sbopkg/queues/[PKGNAME].sqf_, where *[PKGNAME]* is the name of the target Slackbuild. Also copy this list to a template file at _/etc/slackpkg/templates/[PKGNAME]_SBo.template_. Again, replace *[PKGNAME]* with the target Slackbuild.

Use the resulting queue file to build your packages. Once complete and copied to the repository, use the template file to install the package and all required dependencies. Slackpkg+ will skip installing any packages already installed on your system.

It may be helpful to use *git* or another version control system to track the template files. These can then be checked out on each computer by cron or manually. This simplifies distribution of new templates and updates to existing templates.

Putting it all together

Here is a working example from start to finish setting up a new repository, distributing the template, packaging the LibreOffice Slackbuild with dependencies, and finally installing it on a target computer. Assumed here is that _/home/localrepo_ is exported via NFS and mounted at the same location on the target computer.

  1. Setup the repository on a computer which will serve packages.
        # mkdir -p /home/localrepo/15.0
        # touch /home/localrepo/15.0/{FILE_LIST,CHECKSUMS.md5}
        
  2. Generate the queue and template files.
            # sbodeps -a libreoffice | tee /var/lib/sbopkg/queues/libreoffice.sqf /etc/slackpkg/template/libreoffice_SBo.template
        
  3. Build and install the packages. Installation of the dependencies is required for most packages, but could be skipped for the target if desired. Skipping will require adjusting these steps to add a second execution of sbopkg with the *-b* option.
        # sbopkg -i -B libreoffice.sqf
        
  4. Copy the resulting packages to the repository. Assuming the repository is mounted on the build computer's file tree,
        # for package in $(cat /var/lib/sbopkg/queues/libreoffice.sqf)
        do 
            mv /tmp/$package-*_SBo.t?z /home/localrepo/15.0/
        done
        
        
  5. Generate the FILE_LIST and CHECKSUMS.md5 files.
        # cd /home/localrepo
        # ls -l *.t?z >> FILE_LIST
        # md5sum *.t?z >> CHECKSUMS.md5
        # sort -o FILE_LIST -k9 -u FILE_LIST
        # sort -o CHECKSUMS.md5 -k2 -u CHECKSUMS.md5
        
  6. Distribute the template file to the target computer.
  7. Install the "meta package" using the template
        # slackpkg update
        # slackpkg install-template libreoffice_SBo
        

Repeat on additional computers where these packages are to be installed.