1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00
systemd-stable/src
Colin Walters f38951a628 systemctl,verbs: Introduce SYSTEMD_OFFLINE environment variable
A lot of code references the `running_in_chroot()` function; while
I didn't dig I'm pretty certain this arose to deal with situations
like RPM package builds in `mock` - there we don't want the `%post`s
to `systemctl start` for example.

And actually this exact same use case arises for
[rpm-ostree](https://github.com/projectatomic/rpm-ostree/)
where we implement offline upgrades by default; the `%post`s are
always run in a new chroot using [bwrap](https://github.com/projectatomic/bubblewrap).

And here's the problem: bwrap creates proper mount roots, so it
passes `running_in_chroot()`, and then if a script tries to do
`systemctl start` we get:
`System has not been booted with systemd as init system (PID 1)`
but that's an *error*, unlike the `running_in_chroot()` case where we ignore.

Further complicating things is there are real world RPM packages
like `glusterfs` which end up invoking `systemctl start`.

A while ago, the `SYSTEMD_IGNORE_CHROOT` environment variable was
added for the inverse case of running in a chroot, but still wanting
to use systemd as PID 1 (presumably some broken initramfs setups?).

Let's introduce a `SYSTEMD_OFFLINE` environment variable for cases like
mock/rpm-ostree so we can force on the "ignore everything except preset" logic.
This way we'll still not start services even if mock switches to use nspawn or
bwrap or something else that isn't a chroot.

We also cleanly supercede the `SYSTEMD_IGNORE_CHROOT=1` which is now spelled
`SYSTEMD_OFFLINE=0`.  (Suggested by @poettering)

Also I made things slightly nicer here and we now print the ignored operation.
2017-12-14 16:00:16 -05:00
..
ac-power Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
activate Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
analyze tree-wide: drop a few == NULL and != NULL comparison 2017-12-11 16:05:40 +01:00
ask-password Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
backlight Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
basic systemctl,verbs: Introduce SYSTEMD_OFFLINE environment variable 2017-12-14 16:00:16 -05:00
binfmt Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
boot Merge pull request #7611 from poettering/bootspec-fixes 2017-12-12 22:16:34 +01:00
busctl busctl: list all short options in help text 2017-12-03 18:40:13 +01:00
cgls Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
cgroups-agent Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
cgtop Add set/hashmap helpers for non-trivial freeing and use where straighforward 2017-11-28 21:30:30 +01:00
core tree-wide: drop a few == NULL and != NULL comparison 2017-12-11 16:05:40 +01:00
coredump tree-wide: drop a few == NULL and != NULL comparison 2017-12-11 16:05:40 +01:00
cryptsetup cryptsetup: use more descriptive name for the variable and drop redundant function 2017-12-12 20:31:25 +01:00
debug-generator Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
delta Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
detect-virt Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
dissect nspawn: make sure images containing an ESP are compatible with userns -U mode 2017-12-05 13:49:12 +01:00
environment-d-generator Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
escape Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
firstboot firstboot: do not write vconsole.conf when arg_keymap is empty 2017-11-25 19:11:57 +09:00
fsck Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
fstab-generator fstab-generator: port some code to strextend_with_separator() 2017-12-05 13:49:13 +01:00
getty-generator Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
gpt-auto-generator generators: be more careful when writing unit settings that support specifier expansion 2017-11-29 12:32:57 +01:00
hibernate-resume Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
hostname hostname-util: rework read_hostname_config() a bit 2017-11-20 16:43:15 +01:00
hwdb Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
import Remove NULL as last parameter to strjoin 2017-11-24 10:37:08 +00:00
initctl Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
journal journal,coredump: do not do ACL magic for "nobody" user either 2017-12-06 13:40:50 +01:00
journal-remote journal-upload: remove duplication of --help and --version in help text 2017-12-03 18:40:13 +01:00
kernel-install Add license headers and SPDX identifiers to meson.build files 2017-11-19 19:08:15 +01:00
libsystemd resolved: implement D-Bus API for DNS-SD 2017-12-08 14:29:27 +02:00
libsystemd-network Add set/hashmap helpers for non-trivial freeing and use where straighforward 2017-11-28 21:30:30 +01:00
libudev Replace free and return NULL with return mfree 2017-11-24 10:31:49 +00:00
locale localectl: fix list_vconsole_keymaps() indentation 2017-12-01 14:41:31 -08:00
login user-util: add new uid_is_system() helper 2017-12-06 13:40:50 +01:00
machine user-util: add UID_NOBODY defines that resolve to (uid_t) 65534 2017-12-06 13:40:50 +01:00
machine-id-setup Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
modules-load Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
mount mount: use chase_symlinks() 2017-12-03 00:29:07 +09:00
network networkd/dhcp: shorten overlong hostname (#7616) 2017-12-13 18:00:46 +01:00
notify Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
nspawn tree-wide: unify logging of "Must be root" message 2017-12-11 23:19:45 +01:00
nss-myhostname Add SPDX license headers to various assorted files 2017-11-19 19:08:15 +01:00
nss-mymachines user-util: add UID_NOBODY defines that resolve to (uid_t) 65534 2017-12-06 13:40:50 +01:00
nss-resolve Add SPDX license headers to various assorted files 2017-11-19 19:08:15 +01:00
nss-systemd user-util: add UID_NOBODY defines that resolve to (uid_t) 65534 2017-12-06 13:40:50 +01:00
partition growfs: fix building without libcrypsetup (#7535) 2017-12-04 10:31:04 +09:00
path Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
quotacheck Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
random-seed Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
rc-local-generator Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
remount-fs Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
reply-password Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
resolve Merge pull request #7588 from poettering/resolve-route-tweak 2017-12-13 13:43:55 +09:00
rfkill Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
run run: run pty forwarder at higher event priority than the bus 2017-12-05 18:33:24 +01:00
shared bootspec: sprinkle some argument assert()s all over the place 2017-12-11 23:19:45 +01:00
sleep Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
socket-proxy Add set/hashmap helpers for non-trivial freeing and use where straighforward 2017-11-28 21:30:30 +01:00
stdio-bridge stdio-bridge: add missing option 2017-12-04 13:11:25 +09:00
sulogin-shell sulogin-shell: replace "^D" by "exit" 2017-12-07 12:42:06 +01:00
sysctl Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
system-update-generator Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
systemctl systemctl,verbs: Introduce SYSTEMD_OFFLINE environment variable 2017-12-14 16:00:16 -05:00
systemd Add a "RequiredForOnline=" Link attribute for .network files (#7347) 2017-11-30 18:03:50 +01:00
sysusers Add set/hashmap helpers for non-trivial freeing and use where straighforward 2017-11-28 21:30:30 +01:00
sysv-generator generators: be more careful when writing unit settings that support specifier expansion 2017-11-29 12:32:57 +01:00
test shared: introduce dnssd_srv_type_is_valid() function 2017-12-08 14:29:27 +02:00
timedate Replace free and reassignment with free_and_replace 2017-11-24 10:33:41 +00:00
timesync tree-wide: adjust fall through comments so that gcc is happy 2017-11-20 13:06:25 -08:00
tmpfiles tmpfiles: also add %t/%S/%C/%L specifiers 2017-12-06 10:30:26 +01:00
tty-ask-password-agent tty-ask-password-agent: drop NULL sentinel 2017-11-29 20:12:26 +01:00
udev tree-wide: unify logging of "Must be root" message 2017-12-11 23:19:45 +01:00
update-done Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
update-utmp Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
user-sessions Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
vconsole tree-wide: drop a few == NULL and != NULL comparison 2017-12-11 16:05:40 +01:00
veritysetup util-lib: export cryptsetup logging glue function 2017-11-30 20:43:25 +01:00
volatile-root Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00