From 08fd84e0d6ee659de12e5d6e712e6d563c04c535 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 17 Jun 2014 13:31:23 -0400 Subject: [PATCH] compose: Add support for "default_target" Currently the systemd RPM ships with default.target -> graphical.target, which is either itself changed by Anaconda (via parsing /etc/sysconfig/desktop, which...anyways let's stop here). Or anaconda might set it directly to multi-user.target. For rpm-ostree, we perform some minimal level of "preconfiguration" per tree, so they are directly usable without an intervening installer. As an example for fedora-atomic/base/core, we just want multi-user.target. Thus, this patch provides the treefile author a declarative mechanism to set it. --- doc/treefile.md | 2 ++ src/rpmostree-compose-builtin-tree.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/doc/treefile.md b/doc/treefile.md index 8ee009ede0..56d7fe3810 100644 --- a/doc/treefile.md +++ b/doc/treefile.md @@ -25,6 +25,8 @@ Treefile * `units`: Array of strings, optional: Systemd units to enable by default + * `default_target`: String, optional: Set the default systemd target + * `include`: string, optional: Path to another treefile which will be used as an inheritance base. The semantics for inheritance are: Non-array values in child values override parent values. Array diff --git a/src/rpmostree-compose-builtin-tree.c b/src/rpmostree-compose-builtin-tree.c index 0765238d6c..c9298298de 100644 --- a/src/rpmostree-compose-builtin-tree.c +++ b/src/rpmostree-compose-builtin-tree.c @@ -1082,6 +1082,25 @@ rpmostree_compose_builtin_tree (int argc, cancellable, NULL, NULL, error)) goto out; } + + { + const char *default_target = NULL; + gs_unref_object GFile *default_target_path = + g_file_resolve_relative_path (yumroot, "usr/etc/systemd/system/default.target"); + + if (!object_get_optional_string_member (treefile, "default_target", + &default_target, error)) + goto out; + + if (default_target != NULL) + { + (void) gs_file_unlink (default_target_path, NULL, NULL); + + if (!g_file_make_symbolic_link (default_target_path, default_target, + cancellable, error)) + goto out; + } + } { const char *gpgkey;