OpenPrinting / OpenPrinting/ipp-usb
Containerization-friendly file/directory placement
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:
- Build command line options
- Command line options when starting the daemon
ipp-usb - Environment variables to be read by
ipp-usb - Entries in the config file
ipp-usb.conf(requires (2) or (3) foripp-usbto find the config file at least)
to change the paths/file names.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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