From 3041d648bbce3beaef2d6b69c8461532e508329d Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 5 Mar 2021 01:29:21 +0000 Subject: [PATCH] install: Add --apply-live OK I think it's time. This exposes the `apply-live` functionality as implicitly stable, but specific to the package install case. I'd like to add more intelligence to `apply-live` around separating pure "additions" (as in this case) versus package (file) changes. The change here doesn't try to do that; the implementation is incredibly simple, we just have the client chain together the two distinct transactions. --- man/rpm-ostree.xml | 14 ++++++++++++++ src/app/rpmostree-pkg-builtins.cxx | 15 +++++++++++++-- tests/kolainst/destructive/apply-live | 3 +-- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/man/rpm-ostree.xml b/man/rpm-ostree.xml index 0f35de3a..1429506c 100644 --- a/man/rpm-ostree.xml +++ b/man/rpm-ostree.xml @@ -229,6 +229,15 @@ Boston, MA 02111-1307, USA. uninstall command. + + If this is the first time a machine-local change is made, + note that this will change rpm-ostree to operate in full + hybrid mode. Concretely, rpm-ostree will also start + fetching all enabled rpm-md (yum) repositories and use + those for package updates every time + rpm-ostree upgrade is invoked. + + rpm-ostree remembers these requests even if a later host update includes those packages already: if the packages are @@ -273,6 +282,11 @@ Boston, MA 02111-1307, USA. invocation to perform the operation completely offline. + + + will perform a subsequent apply-live + operation to apply changes to the booted deployment. + diff --git a/src/app/rpmostree-pkg-builtins.cxx b/src/app/rpmostree-pkg-builtins.cxx index e9e5ec5b..0597f4b0 100644 --- a/src/app/rpmostree-pkg-builtins.cxx +++ b/src/app/rpmostree-pkg-builtins.cxx @@ -32,6 +32,7 @@ static char *opt_osname; static gboolean opt_reboot; static gboolean opt_dry_run; +static gboolean opt_apply_live; static gboolean opt_idempotent; static gchar **opt_install; static gchar **opt_uninstall; @@ -63,6 +64,7 @@ static GOptionEntry install_option_entry[] = { { "uninstall", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_uninstall, "Remove overlayed additional package", "PKG" }, { "cache-only", 'C', 0, G_OPTION_ARG_NONE, &opt_cache_only, "Do not download latest ostree and RPM data", NULL }, { "download-only", 0, 0, G_OPTION_ARG_NONE, &opt_download_only, "Just download latest ostree and RPM data, don't deploy", NULL }, + { "apply-live", 'A', 0, G_OPTION_ARG_NONE, &opt_apply_live, "Apply changes to both pending deployment and running filesystem tree", NULL }, { NULL } }; @@ -182,10 +184,19 @@ rpmostree_builtin_install (int argc, argv++; argc--; argv[argc] = NULL; - return pkg_change (invocation, sysroot_proxy, + if (!pkg_change (invocation, sysroot_proxy, (const char *const*)argv, (const char *const*)opt_uninstall, - cancellable, error); + cancellable, error)) + return FALSE; + + if (opt_apply_live) + { + rust::Vec rustargv; + rpmostreecxx::applylive_entrypoint(rustargv); + } + + return TRUE; } gboolean diff --git a/tests/kolainst/destructive/apply-live b/tests/kolainst/destructive/apply-live index 0227b178..5522e187 100755 --- a/tests/kolainst/destructive/apply-live +++ b/tests/kolainst/destructive/apply-live @@ -96,8 +96,7 @@ rm -rf /etc/testpkg-etc \ echo myconfig > /etc/testpkg-etc-other.conf grep myconfig /etc/testpkg-etc-other.conf -rpm-ostree install testpkg-etc testdaemon -rpm-ostree ex apply-live +rpm-ostree install -A testpkg-etc testdaemon rpm -q bar test{pkg-etc,daemon} > rpmq.txt assert_file_has_content rpmq.txt bar-1.0-1 test{pkg-etc,daemon}-1.0-1 cat /etc/testpkg-etc.conf > testpkg-etc.conf