instead of reboot when a new root file system has been loaded in
`/run/nextroot/`.
+* `SYSTEMD_PRESET_BYPASS=1` — If set, execution of `systemctl preset` and
+ `systemctl preset-all` is skipped. This can be useful if either of these is
+ invoked unconditionally as a child process by another tool, such as package
+ managers running it in a postinstall script.
+
`systemd-nspawn`:
* `$SYSTEMD_NSPAWN_UNIFIED_HIERARCHY=1` — if set, force `systemd-nspawn` into
subvolumes if the backing filesystem supports them. If set to `0`, these
lines will always create directories.
+* `SYSTEMD_TMPFILES_BYPASS=1` — If set, execution of `systemd-tmpfiles` is
+ skipped. This can be useful if `systemd-tmpfiles` is invoked unconditionally
+ as a child process by another tool, such as package managers running it in a
+ postinstall script.
+
`systemd-sysusers`:
* `$SOURCE_DATE_EPOCH` — if unset, the field of the date of last password change
reproducible value for the field of the date of last password change in
`/etc/shadow`. See: https://reproducible-builds.org/specs/source-date-epoch/
+* `SYSTEMD_SYSUSERS_BYPASS=1` — If set, execution of `systemd-sysusers` is
+ skipped. This can be useful if `systemd-sysusers` is invoked unconditionally
+ as a child process by another tool, such as package managers running it in a
+ postinstall script.
+
`systemd-sysv-generator`:
* `$SYSTEMD_SYSVINIT_PATH` — Controls where `systemd-sysv-generator` looks for
}
static bool bypass(void) {
- int r;
-
- r = getenv_bool("KERNEL_INSTALL_BYPASS");
- if (r < 0 && r != -ENXIO)
- log_debug_errno(r, "Failed to parse $KERNEL_INSTALL_BYPASS, assuming no.");
- if (r <= 0)
- return false;
-
- log_debug("$KERNEL_INSTALL_BYPASS is enabled, skipping execution.");
- return true;
+ return should_bypass("KERNEL_INSTALL");
}
static int do_add(
#include "string-util.h"
#include "strv.h"
#include "tmpfile-util.h"
+#include "verbs.h"
static const char* const conf_file_dirs[] = {
"/etc/udev/hwdb.d",
}
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;
+ return should_bypass("SYSTEMD_HWDB_UPDATE");
}
return r > 0;
}
+bool should_bypass(const char *env_prefix) {
+ char *env;
+ int r;
+
+ assert(env_prefix);
+
+ env = strjoina(env_prefix, "_BYPASS");
+
+ r = getenv_bool(env);
+ if (r < 0 && r != -ENXIO)
+ log_debug_errno(r, "Failed to parse $%s, assuming no: %m", env);
+ if (r <= 0)
+ return false;
+
+ log_debug("$%s is enabled, skipping execution.", env);
+ return true;
+}
+
const Verb* verbs_find_verb(const char *name, const Verb verbs[]) {
assert(verbs);
bool running_in_chroot_or_offline(void);
+bool should_bypass(const char *env_prefix);
+
const Verb* verbs_find_verb(const char *name, const Verb verbs[]);
int dispatch_verb(int argc, char *argv[], const Verb verbs[], void *userdata);
#include "systemctl-sysv-compat.h"
#include "systemctl-util.h"
#include "systemctl.h"
+#include "verbs.h"
static int normalize_link_paths(char **paths) {
int r;
sd_bus *bus = NULL;
int r;
+ if (streq(verb, "preset") && should_bypass("SYSTEMD_PRESET"))
+ return 0;
+
const char *operation = strjoina("to ", verb);
r = mangle_names(operation, ASSERT_PTR(strv_skip(argv, 1)), &names);
if (r < 0)
#include "systemctl-preset-all.h"
#include "systemctl-util.h"
#include "systemctl.h"
+#include "verbs.h"
int verb_preset_all(int argc, char *argv[], void *userdata) {
int r;
+ if (should_bypass("SYSTEMD_PRESET"))
+ return 0;
+
if (install_client_side()) {
InstallChange *changes = NULL;
size_t n_changes = 0;
#include "uid-range.h"
#include "user-util.h"
#include "utf8.h"
+#include "verbs.h"
typedef enum ItemType {
ADD_USER = 'u',
if (arg_cat_flags != CAT_CONFIG_OFF)
return cat_config();
+ if (should_bypass("SYSTEMD_SYSUSERS"))
+ return 0;
+
umask(0022);
r = mac_init();
#include "terminal-util.h"
#include "umask-util.h"
#include "user-util.h"
+#include "verbs.h"
#include "virt.h"
#include "xattr-util.h"
if (arg_cat_flags != CAT_CONFIG_OFF)
return cat_config(config_dirs, argv + optind);
+ if (should_bypass("SYSTEMD_TMPFILES"))
+ return 0;
+
umask(0022);
r = mac_init();