mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
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:
parent
bd546b9b48
commit
3d11b46bf7
@ -249,6 +249,14 @@ All tools:
|
||||
devices sysfs path are actually backed by sysfs. Relaxing this verification
|
||||
is useful for testing purposes.
|
||||
|
||||
`udevadm` and `systemd-hwdb`:
|
||||
|
||||
* `SYSTEMD_HWDB_UPDATE_BYPASS=` — If set to "1", execution of hwdb updates is skipped
|
||||
when `udevadm hwdb --update` or `systemd-hwdb update` are invoked. This can
|
||||
be useful if either of these tools are invoked unconditionally as a child
|
||||
process by another tool, such as package managers running either of these
|
||||
tools in a postinstall script.
|
||||
|
||||
`nss-systemd`:
|
||||
|
||||
* `$SYSTEMD_NSS_BYPASS_SYNTHETIC=1` — if set, `nss-systemd` won't synthesize
|
||||
|
@ -22,6 +22,9 @@ static int verb_query(int argc, char *argv[], void *userdata) {
|
||||
}
|
||||
|
||||
static int verb_update(int argc, char *argv[], void *userdata) {
|
||||
if (hwdb_bypass())
|
||||
return 0;
|
||||
|
||||
return hwdb_update(arg_root, arg_hwdb_bin_dir, arg_strict, false);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -89,7 +89,7 @@ int hwdb_main(int argc, char *argv[], void *userdata) {
|
||||
|
||||
log_notice("udevadm hwdb is deprecated. Use systemd-hwdb instead.");
|
||||
|
||||
if (arg_update) {
|
||||
if (arg_update && !hwdb_bypass()) {
|
||||
r = hwdb_update(arg_root, arg_hwdb_bin_dir, arg_strict, true);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
Loading…
Reference in New Issue
Block a user