]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/shared/hwdb-util.c
Merge pull request #32993 from poettering/cryptenroll-no-pcr
[thirdparty/systemd.git] / src / shared / hwdb-util.c
index f67e917b533c36316a4bb8b7aea6ca7a3774e053..d96902c7f26fe737eb1f38f6340c55dcad9c5384 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "alloc-util.h"
 #include "conf-files.h"
+#include "env-util.h"
 #include "fd-util.h"
 #include "fileio.h"
 #include "fs-util.h"
@@ -483,7 +484,7 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
                 if (r == 0)
                         break;
 
-                line_number ++;
+                line_number++;
 
                 /* comment line */
                 if (line[0] == '#')
@@ -710,3 +711,16 @@ bool hwdb_should_reload(sd_hwdb *hwdb) {
                 return true;
         return false;
 }
+
+int hwdb_bypass(void) {
+        int r;
+
+        r = getenv_bool("SYSTEMD_HWDB_UPDATE_BYPASS");
+        if (r < 0 && r != -ENXIO)
+                log_debug_errno(r, "Failed to parse $SYSTEMD_HWDB_UPDATE_BYPASS, assuming no.");
+        if (r <= 0)
+                return false;
+
+        log_debug("$SYSTEMD_HWDB_UPDATE_BYPASS is enabled, skipping execution.");
+        return true;
+}