Blame 0001-feat-hwdb-add-hwdb-module-to-install-hwdb.bin-on-dem.patch

43355b
From 3bcb0a9f06bac7fa62dc7241860deb8b671f17cd Mon Sep 17 00:00:00 2001
218d2d
From: Pavel Valena <pvalena@redhat.com>
218d2d
Date: Tue, 25 Apr 2023 14:56:59 +0200
43355b
Subject: [PATCH 1/6] feat(hwdb): add hwdb module to install hwdb.bin on demand
218d2d
218d2d
Module to install hwdb.bin. Further extensions might make only selected
218d2d
part of hwdb installable to save space. The module is not included by default.
218d2d
218d2d
Including the module adds 2MB of compressed data (on Fedora, the file has 12MB).
218d2d
218d2d
Installing hwdb.bin is needed in case of custom HW like a keyboard/mouse, or various interfaces.
218d2d
218d2d
Original PR: https://github.com/dracutdevs/dracut/pull/1681
218d2d
---
218d2d
 modules.d/95hwdb/module-setup.sh | 26 ++++++++++++++++++++++++++
218d2d
 1 file changed, 26 insertions(+)
218d2d
 create mode 100755 modules.d/95hwdb/module-setup.sh
218d2d
218d2d
diff --git a/modules.d/95hwdb/module-setup.sh b/modules.d/95hwdb/module-setup.sh
218d2d
new file mode 100755
218d2d
index 00000000..5d3250f3
218d2d
--- /dev/null
218d2d
+++ b/modules.d/95hwdb/module-setup.sh
218d2d
@@ -0,0 +1,26 @@
218d2d
+#!/bin/bash
218d2d
+# This file is part of dracut.
218d2d
+# SPDX-License-Identifier: GPL-2.0-or-later
218d2d
+
218d2d
+check() {
218d2d
+    return 255
218d2d
+}
218d2d
+
218d2d
+# called by dracut
218d2d
+install() {
218d2d
+    local hwdb_bin
218d2d
+
218d2d
+    # Follow the same priority as `systemd-hwdb`; `/etc` is the default
218d2d
+    # and `/usr/lib` an alternative location.
218d2d
+    hwdb_bin="${udevconfdir}"/hwdb.bin
218d2d
+
218d2d
+    if [[ ! -r ${hwdb_bin} ]]; then
218d2d
+        hwdb_bin="${udevdir}"/hwdb.bin
218d2d
+    fi
218d2d
+
218d2d
+    if [[ $hostonly ]]; then
218d2d
+        inst_multiple -H "${hwdb_bin}"
218d2d
+    else
218d2d
+        inst_multiple "${hwdb_bin}"
218d2d
+    fi
218d2d
+}
218d2d
-- 
218d2d
2.42.0
218d2d