forked from coreos/rpm-ostree
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
But I've been playing with this interactively, and it's at a useful place already. The primary target here is supporting live addition of new packages, while *also* allowing people to do completely arbitrary replacement if that's what they want. Depends: GNOME/libglnx#36 ostreedev/ostree#714 Closes: coreos#639
- Loading branch information
Showing
17 changed files
with
891 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- | ||
* | ||
* Copyright (C) 2017 Colin Walters <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation; either version 2 of the licence or (at | ||
* your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General | ||
* Public License along with this library; if not, write to the | ||
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, | ||
* Boston, MA 02111-1307, USA. | ||
*/ | ||
|
||
#include "config.h" | ||
|
||
#include <string.h> | ||
#include <glib-unix.h> | ||
|
||
#include "rpmostree-ex-builtins.h" | ||
#include "rpmostree-libbuiltin.h" | ||
#include "rpmostree-dbus-helpers.h" | ||
|
||
#include <libglnx.h> | ||
|
||
static gboolean opt_dry_run; | ||
static gboolean opt_allow_replace; | ||
static gboolean opt_accept_partial; | ||
|
||
static GOptionEntry option_entries[] = { | ||
{ "dry-run", 'n', 0, G_OPTION_ARG_NONE, &opt_dry_run, "Only perform analysis, do not make changes", NULL }, | ||
{ "allow-replace", 0, 0, G_OPTION_ARG_NONE, &opt_allow_replace, "Allow replacing existing files", NULL }, | ||
{ "accept-partial", 0, 0, G_OPTION_ARG_NONE, &opt_accept_partial, "Continue even on partial updates", NULL }, | ||
{ NULL } | ||
}; | ||
|
||
static GVariant * | ||
get_args_variant (void) | ||
{ | ||
GVariantDict dict; | ||
|
||
g_variant_dict_init (&dict, NULL); | ||
g_variant_dict_insert (&dict, "dry-run", "b", opt_dry_run); | ||
g_variant_dict_insert (&dict, "replace", "b", opt_allow_replace); | ||
g_variant_dict_insert (&dict, "partial", "b", opt_accept_partial); | ||
|
||
return g_variant_dict_end (&dict); | ||
} | ||
|
||
int | ||
rpmostree_ex_builtin_livefs (int argc, | ||
char **argv, | ||
RpmOstreeCommandInvocation *invocation, | ||
GCancellable *cancellable, | ||
GError **error) | ||
{ | ||
int exit_status = EXIT_FAILURE; | ||
g_autoptr(GOptionContext) context = g_option_context_new ("- Apply pending deployment changes to booted deployment"); | ||
glnx_unref_object RPMOSTreeOS *os_proxy = NULL; | ||
glnx_unref_object RPMOSTreeSysroot *sysroot_proxy = NULL; | ||
g_autofree char *transaction_address = NULL; | ||
|
||
if (!rpmostree_option_context_parse (context, | ||
option_entries, | ||
&argc, &argv, | ||
invocation, | ||
cancellable, | ||
&sysroot_proxy, | ||
error)) | ||
goto out; | ||
|
||
if (!rpmostree_load_os_proxy (sysroot_proxy, NULL, | ||
cancellable, &os_proxy, error)) | ||
goto out; | ||
|
||
if (!rpmostree_os_call_live_fs_sync (os_proxy, | ||
get_args_variant (), | ||
&transaction_address, | ||
cancellable, | ||
error)) | ||
goto out; | ||
|
||
if (!rpmostree_transaction_get_response_sync (sysroot_proxy, | ||
transaction_address, | ||
cancellable, | ||
error)) | ||
goto out; | ||
|
||
exit_status = EXIT_SUCCESS; | ||
out: | ||
/* Does nothing if using the message bus. */ | ||
rpmostree_cleanup_peer (); | ||
|
||
return exit_status; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.