OpenPrinting / OpenPrinting/ipp-usb

Containerization-friendly file/directory placement

Open
#108 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
209
Forks
33
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with paths.go to inventory the hard-coded configuration, state, lock, socket, and log paths, then review snapcraft.yaml and ipp-usb.conf to understand the packaging and configuration constraints. Define a consistent build-time or runtime mechanism for overriding the paths, and verify that the Snap build no longer needs to edit paths.go before building.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.