Add $SYSTEMD_HWDB_UPDATE_BYPASS (#30463)

Same as $KERNEL_INSTALL_BYPASS, but for hwdb. This will speed up
cross architecture image builds in mkosi as I can disable package
managers from running the costly hwdb update stuff in qemu user
mode and run it myself with a native systemd-hwdb with --root=.
This commit is contained in:
Daan De Meyer
2023-12-14 18:57:05 +09:00
committed by GitHub
parent bd546b9b48
commit 3d11b46bf7
5 changed files with 27 additions and 1 deletions
+14
View 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"
@@ -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;
}
+1
View File
@@ -8,3 +8,4 @@
bool hwdb_should_reload(sd_hwdb *hwdb);
int hwdb_update(const char *root, const char *hwdb_bin_dir, bool strict, bool compat);
int hwdb_query(const char *modalias, const char *root);
int hwdb_bypass(void);