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.
This commit is contained in:
Colin Walters 2021-03-05 01:29:21 +00:00 committed by OpenShift Merge Robot
parent 485c1862ce
commit 3041d648bb
3 changed files with 28 additions and 4 deletions

View File

@ -229,6 +229,15 @@ Boston, MA 02111-1307, USA.
<command>uninstall</command> command. <command>uninstall</command> command.
</para> </para>
<para>
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
<command>rpm-ostree upgrade</command> is invoked.
</para>
<para> <para>
rpm-ostree remembers these requests even if a later host rpm-ostree remembers these requests even if a later host
update includes those packages already: if the packages are update includes those packages already: if the packages are
@ -273,6 +282,11 @@ Boston, MA 02111-1307, USA.
<option>--cache-only</option> invocation to perform the <option>--cache-only</option> invocation to perform the
operation completely offline. operation completely offline.
</para> </para>
<para>
<option>--apply-live</option> will perform a subsequent <command>apply-live</command>
operation to apply changes to the booted deployment.
</para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -32,6 +32,7 @@
static char *opt_osname; static char *opt_osname;
static gboolean opt_reboot; static gboolean opt_reboot;
static gboolean opt_dry_run; static gboolean opt_dry_run;
static gboolean opt_apply_live;
static gboolean opt_idempotent; static gboolean opt_idempotent;
static gchar **opt_install; static gchar **opt_install;
static gchar **opt_uninstall; 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" }, { "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 }, { "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 }, { "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 } { NULL }
}; };
@ -182,10 +184,19 @@ rpmostree_builtin_install (int argc,
argv++; argc--; argv++; argc--;
argv[argc] = NULL; argv[argc] = NULL;
return pkg_change (invocation, sysroot_proxy, if (!pkg_change (invocation, sysroot_proxy,
(const char *const*)argv, (const char *const*)argv,
(const char *const*)opt_uninstall, (const char *const*)opt_uninstall,
cancellable, error); cancellable, error))
return FALSE;
if (opt_apply_live)
{
rust::Vec<rust::String> rustargv;
rpmostreecxx::applylive_entrypoint(rustargv);
}
return TRUE;
} }
gboolean gboolean

View File

@ -96,8 +96,7 @@ rm -rf /etc/testpkg-etc \
echo myconfig > /etc/testpkg-etc-other.conf echo myconfig > /etc/testpkg-etc-other.conf
grep myconfig /etc/testpkg-etc-other.conf grep myconfig /etc/testpkg-etc-other.conf
rpm-ostree install testpkg-etc testdaemon rpm-ostree install -A testpkg-etc testdaemon
rpm-ostree ex apply-live
rpm -q bar test{pkg-etc,daemon} > rpmq.txt 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 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 cat /etc/testpkg-etc.conf > testpkg-etc.conf