scripts: Make use of SYSTEMD_OFFLINE environment variable
More info at:
https://github.com/systemd/systemd/pull/7631 AKA
"systemctl,verbs: Introduce SYSTEMD_OFFLINE environment variable"
f38951a628
and in the docs added.
Closes: #1157
Approved by: jlebon
This commit is contained in:
parent
f63589d37c
commit
f872ecdd13
@ -340,6 +340,14 @@ rpmostree_bwrap_set_child_setup (RpmOstreeBwrap *bwrap,
|
||||
bwrap->child_setup_data = data;
|
||||
}
|
||||
|
||||
|
||||
/* Set an environment variable in the child process */
|
||||
void
|
||||
rpmostree_bwrap_setenv (RpmOstreeBwrap *bwrap, const char *name, const char *value)
|
||||
{
|
||||
g_subprocess_launcher_setenv (bwrap->launcher, name, value, TRUE);
|
||||
}
|
||||
|
||||
/* Execute @bwrap - must have been configured. After executing this method, the
|
||||
* @bwrap instance cannot be run again.
|
||||
*/
|
||||
|
@ -46,6 +46,8 @@ RpmOstreeBwrap *rpmostree_bwrap_new (int rootfs,
|
||||
void rpmostree_bwrap_append_bwrap_argv (RpmOstreeBwrap *bwrap, ...) G_GNUC_NULL_TERMINATED;
|
||||
void rpmostree_bwrap_append_child_argv (RpmOstreeBwrap *bwrap, ...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
void rpmostree_bwrap_setenv (RpmOstreeBwrap *bwrap, const char *name, const char *value);
|
||||
|
||||
void rpmostree_bwrap_set_child_setup (RpmOstreeBwrap *bwrap,
|
||||
GSpawnChildSetupFunc func,
|
||||
gpointer data);
|
||||
|
@ -3427,6 +3427,10 @@ rpmostree_context_assemble (RpmOstreeContext *self,
|
||||
* start` in its %post which both violates Fedora policy and also will not
|
||||
* work with the rpm-ostree model.
|
||||
* See also https://github.com/projectatomic/rpm-ostree/issues/550
|
||||
*
|
||||
* See also the SYSTEMD_OFFLINE bits in rpmostree-scripts.c; at some
|
||||
* point in the far future when we don't support CentOS7 we can drop
|
||||
* our wrapper script. If we remember.
|
||||
*/
|
||||
if (renameat (tmprootfs_dfd, "usr/bin/systemctl",
|
||||
tmprootfs_dfd, "usr/bin/systemctl.rpmostreesave") < 0)
|
||||
|
@ -278,6 +278,11 @@ run_script_in_bwrap_container (int rootfs_fd,
|
||||
if (!bwrap)
|
||||
goto out;
|
||||
|
||||
/* https://github.com/systemd/systemd/pull/7631 AKA
|
||||
* "systemctl,verbs: Introduce SYSTEMD_OFFLINE environment variable"
|
||||
* https://github.com/systemd/systemd/commit/f38951a62837a00a0b1ff42d007e9396b347742d
|
||||
*/
|
||||
rpmostree_bwrap_setenv (bwrap, "SYSTEMD_OFFLINE", "1");
|
||||
|
||||
struct ChildSetupData data = { .stdin_fd = stdin_fd,
|
||||
.stdout_fd = -1,
|
||||
|
@ -217,6 +217,11 @@ if vm_rpmostree install etc-mutate; then
|
||||
assert_not_reached "successfully installed etc-mutate?"
|
||||
fi
|
||||
|
||||
# SYSTEMD_OFFLINE
|
||||
vm_build_rpm test-systemd-offline post 'test "${SYSTEMD_OFFLINE}" = 1'
|
||||
vm_rpmostree install test-systemd-offline
|
||||
vm_rpmostree uninstall test-systemd-offline
|
||||
|
||||
# Ensure this is reset; at least in the Vagrant box with
|
||||
# fedora-atomic:fedora/26/x86_64/atomic-host
|
||||
# Version: 26.131 (2017-09-19 22:29:04)
|
||||
|
Loading…
Reference in New Issue
Block a user