-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(hwdb): install hwdb on demand when module is needed #2443
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
# This file is part of dracut. | ||
# SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
check() { | ||
return 255 | ||
} | ||
|
||
# called by dracut | ||
install() { | ||
local hwdb_bin | ||
|
||
# systemd-hwdb ships the file in /etc, with /usr/lib as an alternative. | ||
# The alternative location is preferred, as we can consider it being user | ||
# configuration. | ||
hwdb_bin="${udevdir}"/hwdb.bin | ||
|
||
if [[ ! -r "${hwdb_bin}" ]]; then | ||
hwdb_bin="${udevconfdir}"/hwdb.bin | ||
fi | ||
|
||
if [[ $hostonly ]]; then | ||
inst_multiple -H "${hwdb_bin}" | ||
else | ||
inst_multiple "${hwdb_bin}" | ||
fi | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
${udevdir}/hwdb.bin
is already unconditionally installed by01systemd-udevd
, so it can be ignored here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I was rather thinking on systemd-udevd depending on this module, which might handle hwdb in more complex way; also not install multiple ones unnecessarily. Please also note that the install is not optional (
-o
) intentionally; and this module is not enabled by default. Does that make sense?There's also an additional benefit of this module working correctly without systemd-udevd :) in case that's ever needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me. This situation is very similar to udev rules - they are installed both by
systemd-udevd
andudev-rules
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a benefit without any value. ATM, HWDB is configuration for
systemd-udevd
, just like.rules
files. It could be used for other things, but it's not.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uff. Does
udev-rules
even work on modern systems? The list of.rules
files seem to be rather short. (OTOH, it contains stuff that makes no sense in initrd, like70-uaccess.rules
or71-seat.rules
.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a Gentoo container (with openrc and musl) where most Dracut tests pass - https://github.com/dracutdevs/dracut/blob/master/test/container/Dockerfile-Gentoo .
If Fedora wishes, it simply can just not package Dracut modules that is not needed for a systemd based initramfs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW - both
udev-rules
andsystemd
Drauct modules seem to include these rules.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say if it's not breaking anything, let's keep it (and this also verifies
hwdb.bin
is present / installed, as udevd module simply runs opt-install).