Skip to content
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 #27

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions dracut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,12 @@ if ! [[ -d "$udevdir" ]]; then
[[ -e /usr/lib/udev/collect ]] && udevdir=/usr/lib/udev
fi
[[ -d $udevconfdir ]] \
|| udevconfdir="$(pkg-config udev --variable=udevconfdir 2>/dev/null)"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this does, but at least the fallback seems to work.

if ! [[ -d "$udevconfdir" ]]; then
[[ -d /etc/udev ]] && udevconfdir=/etc/udev
fi
[[ -d $systemdutildir ]] \
|| systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
Expand Down
1 change: 1 addition & 0 deletions dracut.spec
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
%{dracutlibdir}/modules.d/91crypt-loop
%{dracutlibdir}/modules.d/95debug
%{dracutlibdir}/modules.d/95fstab-sys
%{dracutlibdir}/modules.d/95hwdb
%{dracutlibdir}/modules.d/95lunmask
%{dracutlibdir}/modules.d/95nvmf
%{dracutlibdir}/modules.d/95resume
Expand Down
26 changes: 26 additions & 0 deletions modules.d/95hwdb/module-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/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.
# Therefore consider this location as preferred for configuration.
pvalena marked this conversation as resolved.
Show resolved Hide resolved
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
}
Loading