Summary
replace distribution-name-specific behavior with a platform capability abstraction.
LUD currently contains logic that identifies distributions using checks such as Ubuntu vs Pop!_OS and otherwise falls back to Unknown.
other actions implicitly assume particular components such as:
- APT
- GRUB
update-grub
- kernelstub
- systemd
- GNOME/gsettings
- Debian package formats
makes behavior depend on distro names even when the actual requirement is a particular package manager, boot configuration system, init system, desktop environment or system capability.
So what
introduce a platform abstraction that detects the facilities available on the host and allows actions to declare what they require.
example:
Platform
├── package manager
│ ├── apt
│ ├── dnf
│ ├── pacman
│ └── unsupported
├── boot configuration
│ ├── grub
│ ├── kernelstub
│ ├── systemd-boot
│ └── unsupported
├── init
│ ├── systemd
│ └── unsupported
├── desktop/settings
│ ├── GNOME
│ ├── KDE
│ └── other
└── audio/session stack
├── PipeWire
├── PulseAudio
└── unknown
actions could check a capability instead of a distro name.
example:
instead of:
if distribution == "Ubuntu":
...
behavior should resemble:
if platform.has("glib-compile-schemas"):
...
or:
platform.package_manager.install(...)
similar, kernel command-line changes should target a detected boot configuration backend instead of assuming /etc/default/grub.
Proposal
Platform detect
centralized object/module responsible for determining:
- OS metadata
- package manager
- boot configuration backend
- init/service manager
- relevant desktop configuration backend
- available helper commands
Package BE
initial implementation:
future implementations may be:
Boot BE
possible interface:
get_kernel_parameters()
add_kernel_parameters(...)
remove_kernel_parameters(...)
apply()
initial implementations could do:
with systemd-boot added independently later.
Why
project is already being used beyond environment inherited from System76.
capability model would:
- reduce distro-specific branching
- prevent inappropriate commands on unsupported distributions
- make support for additional distributions incremental
- simplify testing
- make
--plan output more accurate
- make hardware actions less coupled to Ubuntu/Pop!_OS assumptions
Tests
platform detect should use fixtures/mocks rather than depending on the CI host.
tests should cover representative environments such as:
- Ubuntu + APT + GRUB
- Pop!_OS + APT + kernelstub
- Debian + APT + GRUB
- non-Debian system with unsupported package backend
- system without supported boot configuration
Summary
replace distribution-name-specific behavior with a platform capability abstraction.
LUD currently contains logic that identifies distributions using checks such as Ubuntu vs Pop!_OS and otherwise falls back to
Unknown.other actions implicitly assume particular components such as:
update-grubmakes behavior depend on distro names even when the actual requirement is a particular package manager, boot configuration system, init system, desktop environment or system capability.
So what
introduce a platform abstraction that detects the facilities available on the host and allows actions to declare what they require.
example:
actions could check a capability instead of a distro name.
example:
instead of:
behavior should resemble:
or:
similar, kernel command-line changes should target a detected boot configuration backend instead of assuming
/etc/default/grub.Proposal
Platform detect
centralized object/module responsible for determining:
Package BE
initial implementation:
future implementations may be:
Boot BE
possible interface:
initial implementations could do:
with systemd-boot added independently later.
Why
project is already being used beyond environment inherited from System76.
capability model would:
--planoutput more accurateTests
platform detect should use fixtures/mocks rather than depending on the CI host.
tests should cover representative environments such as: