Perkify - APT Details

Written by Rich Morin.

Contents: (hide) (show)

Path:  AreasContentHowTos

Precis:  detailed discussion of APT packaging, etc.

Most of Perkify’s added packages are installed using Debian’s Advanced Package Toolkit (APT). The vast majority of these packages Just Work for our build system. However, some packages don’t exist already or have characteristics (e.g., configuration dialogs) which cause problems for our build system. In order to resolve these issues, we need to dig into APT a bit.

Note: If you’re looking for an introduction to APT usage on Perkify, see Perkify - APT.

Example (Emacspeak)

Emacspeak is a blind-friendly version of Emacs. We definitely want to include it in Perkify, but its APT package uses a configuration dialog. Let’s see if there’s anything we can do about that.

Web Pages

To get started, we need to find and peruse a few web pages. Ubuntu’s emacspeak package is based on Debian’s, so we may need to look in both places:

Files

Ubuntu’s package page for emacspeak has a section for “Download Source Package”, containing three links:

After an archive has been downloaded, it can be unpacked using tar(1):

$ tar xf emacspeak_49.0+dfsg.orig.tar.xz
$ tar xf emacspeak_49.0+dfsg-3.debian.tar.xz

This produces two directories, debian and emacspeak_49.0. The debian directory contains several dozen files (gleep), but no sub-directories (whew). The emacspeak_49.0 several sub-directories and several hundred files. We won’t be modifying anything in this directory tree, but we may need to examine it to find out things about Emacspeak.

Approach

In order to install Emacspeak interactively, we need to emulate the expected behavior of our get_apt script. This presents us with a series of terminal-based GUI dialogs. Edited for brevity, our terminal session looks something like this:

sudo apt-get install -y emacspeak
...
Default speech server:
  ...
  espeak
  sound card with Software DECtalk

                        <Ok>

If a hardware device is used to generate speech, please enter the
Unix device file associated with it ...                                                                                   │

                        <Ok>

We’re installing eSpeakNG, so espeak and “none” are plausible selections. Assuming these are OK, how can we make them non-interactively?

I’m delighted you asked… It turns out that, now that Emacspeak has been installed, we can examine its configuration parameters as follows:

vagrant@perkify-make:~$ sudo debconf-get-selections | more
...
# Hardware port of the speech generation device:
emacspeak   shared/emacspeak/port    string  none
...
# Default speech server:
emacspeak   shared/emacspeak/device  select  espeak
...

Note: It isn’t always obvious how to identify the configuration parameters for a particular package. For instance, the configuration dialog (and thus, its parameters) may actually be generated by a dependency.

Having determined the configuration parameters, we put them (suitably commented) into the apt_presets file:

# Package Name    Database Key              Type      Value
# ------------    ------------              ----      -----
emacspeak         shared/emacspeak/port     string    none
emacspeak         shared/emacspeak/device   select    espeak
...

The add_ons script can then load this file:

debconf-set-selections apt_presets

Resources

Debian Administrator’s Handbook

The “Debian Administrator’s Handbook” is a gold mine of useful (albeit slightly dated) advice and information. Here are some links:

Debian New Maintainers’ Guide

The “Debian New Maintainers’ Guide” contains a great deal of information on creating Debian packages, etc. Here are some links:

Packaging

Unattended Installation

To be continued…