Skip to content

Containerization-friendly file/directory placement #108

@tillkamppeter

Description

@tillkamppeter

The ipp-usb daemon uses some files, for configuration, USB quirk rules, remembereing the use of the ports, and logging. For this, paths are had-coded in the paths.go file (comments removed):

package main
const (
        PathConfDir = "/etc/ipp-usb"
        PathConfQuirksDir = "/etc/ipp-usb/quirks"
        PathQuirksDir = "/usr/share/ipp-usb/quirks"
        PathProgState = "/var/ipp-usb"
        PathLockDir = PathProgState + "/lock"
        PathLockFile = PathLockDir + "/ipp-usb.lock"
        PathControlSocket = PathProgState + "/ctrl"
        PathProgStateDev = PathProgState + "/dev"
        PathLogDir = "/var/log/ipp-usb"
        PathLogFile = PathLogDir + "/main.log"
)

In a container, like a Snap or an OCI container there is often not the same file system available as in a classic operating system environment without containerization/sandboxing. Also applications can be shipped in immutable file systems, meaning that one cannot write into the directories in which the application itself is delivered.

Therefore there must be an easy way to redefine the places of the files which ipp-usb is using, so that one can easily package it in a containerized, snadboxed, and/or immutable format.

The Snap for example has the immutable file system with which ipp-usb is shipped in /snap/ipp-usb/current/ and it can write files only into subdirectories of /var/snap/ipp-usb/current/ and /var/snap/ipp-usb/common/, meaning that the file paths need to be appropriately redefined for the Snap build. Currently, we go the awkward way of modifying paths.go with a command line editor (in our case perl) before building ipp-usb in snapcraft.yaml.

To make it easier I suggest to add one or more (ideally all) of the following methods:

  1. Build command line options
  2. Command line options when starting the daemon ipp-usb
  3. Environment variables to be read by ipp-usb
  4. Entries in the config file ipp-usb.conf (requires (2) or (3) for ipp-usb to find the config file at least)

to change the paths/file names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions