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
}
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);
}
#include "alloc-util.h"
#include "conf-files.h"
+#include "env-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
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;
+}
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);
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;