systemctl-is-system-running: display "offline" with --image

With the `--image` option, the `running_in_chroot` check is not enough. E.g.:

```
> build/systemctl --image /tmp/20240108-openSUSE.raw is-system-running
running
```
This commit is contained in:
Antonio Alvarez Feijoo
2024-01-15 11:58:38 +00:00
committed by Luca Boccassi
parent a663ddc04e
commit b551a687a4
+1 -1
View File
@@ -29,7 +29,7 @@ int verb_is_system_running(int argc, char *argv[], void *userdata) {
sd_bus *bus;
int r;
if (running_in_chroot() > 0 || (arg_transport == BUS_TRANSPORT_LOCAL && !sd_booted())) {
if (!isempty(arg_root) || running_in_chroot() > 0 || (arg_transport == BUS_TRANSPORT_LOCAL && !sd_booted())) {
if (!arg_quiet)
puts("offline");
return EXIT_FAILURE;