]> git.ipfire.org Git - pakfire.git/commitdiff
jail: Set SYSTEMD_OFFLINE when in chroot
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 30 Dec 2022 14:22:49 +0000 (14:22 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 30 Dec 2022 14:22:49 +0000 (14:22 +0000)
This will prevent systemctl to talk to systemd which won't work in a
chroot environment.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/jail.c

index 7929415ded32d342effe7c24668dd1eec728555e..68c2681e1cca6a7b221defba2f3cf28b2a92e72b 100644 (file)
@@ -261,6 +261,13 @@ PAKFIRE_EXPORT int pakfire_jail_create(struct pakfire_jail** jail,
                        goto ERROR;
        }
 
+       // Disable systemctl to talk to systemd
+       if (!pakfire_on_root(j->pakfire)) {
+               r = pakfire_jail_set_env(j, "SYSTEMD_OFFLINE", "1");
+               if (r)
+                       goto ERROR;
+       }
+
        // Done
        *jail = j;
        return 0;