New upstream version 2019.4
This commit is contained in:
commit
bfa407c9d3
33 files changed
+445
-127
No files matched your search
@@ -26,6 +26,9 @@ DefaultDependencies=no
|
||||
RequiresMountsFor=/sysroot
|
||||
After=local-fs.target
|
||||
Before=basic.target final.target
|
||||
# We want to make sure the transaction logs are persisted to disk:
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1751272
|
||||
After=systemd-journal-flush.service
|
||||
Conflicts=final.target
|
||||
|
||||
[Service]
|
||||
|
||||
@@ -571,6 +571,10 @@ global:
|
||||
ostree_kernel_args_to_string;
|
||||
} LIBOSTREE_2018.9;
|
||||
|
||||
LIBOSTREE_2019.4 {
|
||||
ostree_repo_mark_commit_partial_reason;
|
||||
} LIBOSTREE_2019.3;
|
||||
|
||||
/* NOTE: Only add more content here in release commits! See the
|
||||
* comments at the top of this file.
|
||||
*/
|
||||
@@ -30,7 +30,6 @@ struct _OstreeBootconfigParser
|
||||
const char *separators;
|
||||
|
||||
GHashTable *options;
|
||||
GPtrArray *lines;
|
||||
};
|
||||
|
||||
typedef GObjectClass OstreeBootconfigParserClass;
|
||||
@@ -48,9 +47,6 @@ ostree_bootconfig_parser_clone (OstreeBootconfigParser *self)
|
||||
{
|
||||
OstreeBootconfigParser *parser = ostree_bootconfig_parser_new ();
|
||||
|
||||
for (guint i = 0; i < self->lines->len; i++)
|
||||
g_ptr_array_add (parser->lines, g_variant_ref (self->lines->pdata[i]));
|
||||
|
||||
GLNX_HASH_TABLE_FOREACH_KV (self->options, const char*, k, const char*, v)
|
||||
g_hash_table_replace (parser->options, g_strdup (k), g_strdup (v));
|
||||
|
||||
@@ -84,7 +80,6 @@ ostree_bootconfig_parser_parse_at (OstreeBootconfigParser *self,
|
||||
for (char **iter = lines; *iter; iter++)
|
||||
{
|
||||
const char *line = *iter;
|
||||
char *keyname = "";
|
||||
|
||||
if (g_ascii_isalpha (*line))
|
||||
{
|
||||
@@ -92,7 +87,6 @@ ostree_bootconfig_parser_parse_at (OstreeBootconfigParser *self,
|
||||
items = g_strsplit_set (line, self->separators, 2);
|
||||
if (g_strv_length (items) == 2 && items[0][0] != '\0')
|
||||
{
|
||||
keyname = items[0];
|
||||
g_hash_table_insert (self->options, items[0], items[1]);
|
||||
g_free (items); /* Transfer ownership */
|
||||
}
|
||||
@@ -101,7 +95,6 @@ ostree_bootconfig_parser_parse_at (OstreeBootconfigParser *self,
|
||||
g_strfreev (items);
|
||||
}
|
||||
}
|
||||
g_ptr_array_add (self->lines, g_variant_new ("(ss)", keyname, line));
|
||||
}
|
||||
|
||||
self->parsed = TRUE;
|
||||
@@ -153,34 +146,29 @@ ostree_bootconfig_parser_write_at (OstreeBootconfigParser *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
/* Write the fields in a deterministic order, following what is used
|
||||
* in the bootconfig example of the BootLoaderspec document:
|
||||
* https://systemd.io/BOOT_LOADER_SPECIFICATION
|
||||
*/
|
||||
const char *fields[] = { "title", "version", "options", "devicetree", "linux", "initrd" };
|
||||
g_autoptr(GHashTable) keys_written = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
g_autoptr(GString) buf = g_string_new ("");
|
||||
g_autoptr(GHashTable) written_overrides = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
for (guint i = 0; i < self->lines->len; i++)
|
||||
for (guint i = 0; i < G_N_ELEMENTS (fields); i++)
|
||||
{
|
||||
GVariant *linedata = self->lines->pdata[i];
|
||||
const char *key;
|
||||
const char *value;
|
||||
const char *line;
|
||||
|
||||
g_variant_get (linedata, "(&s&s)", &key, &line);
|
||||
|
||||
value = g_hash_table_lookup (self->options, key);
|
||||
if (value == NULL)
|
||||
{
|
||||
g_string_append (buf, line);
|
||||
g_string_append_c (buf, '\n');
|
||||
}
|
||||
else
|
||||
const char *key = fields[i];
|
||||
const char *value = g_hash_table_lookup (self->options, key);
|
||||
if (value != NULL)
|
||||
{
|
||||
write_key (self, buf, key, value);
|
||||
g_hash_table_add (written_overrides, (gpointer)key);
|
||||
g_hash_table_add (keys_written, (gpointer)key);
|
||||
}
|
||||
}
|
||||
|
||||
/* Write unknown fields */
|
||||
GLNX_HASH_TABLE_FOREACH_KV (self->options, const char*, k, const char*, v)
|
||||
{
|
||||
if (g_hash_table_lookup (written_overrides, k))
|
||||
if (g_hash_table_lookup (keys_written, k))
|
||||
continue;
|
||||
write_key (self, buf, k, v);
|
||||
}
|
||||
@@ -210,7 +198,6 @@ ostree_bootconfig_parser_finalize (GObject *object)
|
||||
OstreeBootconfigParser *self = OSTREE_BOOTCONFIG_PARSER (object);
|
||||
|
||||
g_hash_table_unref (self->options);
|
||||
g_ptr_array_unref (self->lines);
|
||||
|
||||
G_OBJECT_CLASS (ostree_bootconfig_parser_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -219,7 +206,6 @@ static void
|
||||
ostree_bootconfig_parser_init (OstreeBootconfigParser *self)
|
||||
{
|
||||
self->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
||||
self->lines = g_ptr_array_new_with_free_func ((GDestroyNotify)g_variant_unref);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -1873,6 +1873,57 @@ ensure_txn_refs (OstreeRepo *self)
|
||||
g_free);
|
||||
}
|
||||
|
||||
/**
|
||||
* ostree_repo_mark_commit_partial_reason:
|
||||
* @self: Repo
|
||||
* @checksum: Commit SHA-256
|
||||
* @is_partial: Whether or not this commit is partial
|
||||
* @in_state: Reason bitmask for partial commit
|
||||
* @error: Error
|
||||
*
|
||||
* Allows the setting of a reason code for a partial commit. Presently
|
||||
* it only supports setting reason bitmask to
|
||||
* OSTREE_REPO_COMMIT_STATE_FSCK_PARTIAL, or
|
||||
* OSTREE_REPO_COMMIT_STATE_NORMAL. This will allow successive ostree
|
||||
* fsck operations to exit properly with an error code if the
|
||||
* repository has been truncated as a result of fsck trying to repair
|
||||
* it.
|
||||
*
|
||||
* Since: 2019.4
|
||||
*/
|
||||
gboolean
|
||||
ostree_repo_mark_commit_partial_reason (OstreeRepo *self,
|
||||
const char *checksum,
|
||||
gboolean is_partial,
|
||||
OstreeRepoCommitState in_state,
|
||||
GError **error)
|
||||
{
|
||||
g_autofree char *commitpartial_path = _ostree_get_commitpartial_path (checksum);
|
||||
if (is_partial)
|
||||
{
|
||||
glnx_autofd int fd = openat (self->repo_dir_fd, commitpartial_path,
|
||||
O_EXCL | O_CREAT | O_WRONLY | O_CLOEXEC | O_NOCTTY, 0644);
|
||||
if (fd == -1)
|
||||
{
|
||||
if (errno != EEXIST)
|
||||
return glnx_throw_errno_prefix (error, "open(%s)", commitpartial_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (in_state & OSTREE_REPO_COMMIT_STATE_FSCK_PARTIAL)
|
||||
if (glnx_loop_write (fd, "f", 1) < 0)
|
||||
return glnx_throw_errno_prefix (error, "write(%s)", commitpartial_path);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ot_ensure_unlinked_at (self->repo_dir_fd, commitpartial_path, 0))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* ostree_repo_mark_commit_partial:
|
||||
* @self: Repo
|
||||
@@ -1880,9 +1931,10 @@ ensure_txn_refs (OstreeRepo *self)
|
||||
* @is_partial: Whether or not this commit is partial
|
||||
* @error: Error
|
||||
*
|
||||
* Commits in "partial" state do not have all their child objects written. This
|
||||
* occurs in various situations, such as during a pull, but also if a "subpath"
|
||||
* pull is used, as well as "commit only" pulls.
|
||||
* Commits in the "partial" state do not have all their child objects
|
||||
* written. This occurs in various situations, such as during a pull,
|
||||
* but also if a "subpath" pull is used, as well as "commit only"
|
||||
* pulls.
|
||||
*
|
||||
* This function is used by ostree_repo_pull_with_options(); you
|
||||
* should use this if you are implementing a different type of transport.
|
||||
@@ -1895,24 +1947,9 @@ ostree_repo_mark_commit_partial (OstreeRepo *self,
|
||||
gboolean is_partial,
|
||||
GError **error)
|
||||
{
|
||||
g_autofree char *commitpartial_path = _ostree_get_commitpartial_path (checksum);
|
||||
if (is_partial)
|
||||
{
|
||||
glnx_autofd int fd = openat (self->repo_dir_fd, commitpartial_path,
|
||||
O_EXCL | O_CREAT | O_WRONLY | O_CLOEXEC | O_NOCTTY, 0644);
|
||||
if (fd == -1)
|
||||
{
|
||||
if (errno != EEXIST)
|
||||
return glnx_throw_errno_prefix (error, "open(%s)", commitpartial_path);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ot_ensure_unlinked_at (self->repo_dir_fd, commitpartial_path, 0))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return ostree_repo_mark_commit_partial_reason (self, checksum, is_partial,
|
||||
OSTREE_REPO_COMMIT_STATE_NORMAL,
|
||||
error);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -385,6 +385,8 @@ check_outstanding_requests_handle_error (OtPullData *pull_data,
|
||||
GError *error = *errorp;
|
||||
if (error)
|
||||
{
|
||||
g_debug ("Request caught error: %s", error->message);
|
||||
|
||||
if (!pull_data->caught_error)
|
||||
{
|
||||
pull_data->caught_error = TRUE;
|
||||
|
||||
@@ -3768,10 +3768,19 @@ load_metadata_internal (OstreeRepo *self,
|
||||
g_autofree char *commitpartial_path = _ostree_get_commitpartial_path (sha256);
|
||||
*out_state = 0;
|
||||
|
||||
if (!glnx_fstatat_allow_noent (self->repo_dir_fd, commitpartial_path, NULL, 0, error))
|
||||
glnx_autofd int fd = -1;
|
||||
if (!ot_openat_ignore_enoent (self->repo_dir_fd, commitpartial_path, &fd, error))
|
||||
return FALSE;
|
||||
if (errno == 0)
|
||||
*out_state |= OSTREE_REPO_COMMIT_STATE_PARTIAL;
|
||||
if (fd != -1)
|
||||
{
|
||||
*out_state |= OSTREE_REPO_COMMIT_STATE_PARTIAL;
|
||||
char reason;
|
||||
if (read (fd, &reason, 1) == 1)
|
||||
{
|
||||
if (reason == 'f')
|
||||
*out_state |= OSTREE_REPO_COMMIT_STATE_FSCK_PARTIAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (self->parent_repo)
|
||||
|
||||
+27
-17
@@ -248,6 +248,26 @@ gboolean ostree_repo_write_config (OstreeRepo *self,
|
||||
GKeyFile *new_config,
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* OstreeRepoCommitState:
|
||||
* @OSTREE_REPO_COMMIT_STATE_NORMAL: Commit is complete. This is the default.
|
||||
* (Since: 2017.14.)
|
||||
* @OSTREE_REPO_COMMIT_STATE_PARTIAL: One or more objects are missing from the
|
||||
* local copy of the commit, but metadata is present. (Since: 2015.7.)
|
||||
* @OSTREE_REPO_COMMIT_STATE_FSCK_PARTIAL: One or more objects are missing from the
|
||||
* local copy of the commit, due to an fsck --delete. (Since: 2019.4.)
|
||||
*
|
||||
* Flags representing the state of a commit in the local repository, as returned
|
||||
* by ostree_repo_load_commit().
|
||||
*
|
||||
* Since: 2015.7
|
||||
*/
|
||||
typedef enum {
|
||||
OSTREE_REPO_COMMIT_STATE_NORMAL = 0,
|
||||
OSTREE_REPO_COMMIT_STATE_PARTIAL = (1 << 0),
|
||||
OSTREE_REPO_COMMIT_STATE_FSCK_PARTIAL = (1 << 1),
|
||||
} OstreeRepoCommitState;
|
||||
|
||||
/**
|
||||
* OstreeRepoTransactionStats:
|
||||
* @metadata_objects_total: The total number of metadata objects
|
||||
@@ -315,6 +335,13 @@ gboolean ostree_repo_mark_commit_partial (OstreeRepo *self,
|
||||
gboolean is_partial,
|
||||
GError **error);
|
||||
|
||||
_OSTREE_PUBLIC
|
||||
gboolean ostree_repo_mark_commit_partial_reason (OstreeRepo *self,
|
||||
const char *checksum,
|
||||
gboolean is_partial,
|
||||
OstreeRepoCommitState in_state,
|
||||
GError **error);
|
||||
|
||||
_OSTREE_PUBLIC
|
||||
void ostree_repo_transaction_set_refspec (OstreeRepo *self,
|
||||
const char *refspec,
|
||||
@@ -526,23 +553,6 @@ gboolean ostree_repo_load_variant_if_exists (OstreeRepo *self,
|
||||
GVariant **out_variant,
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* OstreeRepoCommitState:
|
||||
* @OSTREE_REPO_COMMIT_STATE_NORMAL: Commit is complete. This is the default.
|
||||
* (Since: 2017.14.)
|
||||
* @OSTREE_REPO_COMMIT_STATE_PARTIAL: One or more objects are missing from the
|
||||
* local copy of the commit, but metadata is present. (Since: 2015.7.)
|
||||
*
|
||||
* Flags representing the state of a commit in the local repository, as returned
|
||||
* by ostree_repo_load_commit().
|
||||
*
|
||||
* Since: 2015.7
|
||||
*/
|
||||
typedef enum {
|
||||
OSTREE_REPO_COMMIT_STATE_NORMAL = 0,
|
||||
OSTREE_REPO_COMMIT_STATE_PARTIAL = (1 << 0),
|
||||
} OstreeRepoCommitState;
|
||||
|
||||
_OSTREE_PUBLIC
|
||||
gboolean ostree_repo_load_commit (OstreeRepo *self,
|
||||
const char *checksum,
|
||||
|
||||
@@ -1746,10 +1746,9 @@ install_deployment_kernel (OstreeSysroot *sysroot,
|
||||
g_string_append_c (title_key, ':');
|
||||
g_string_append (title_key, osname);
|
||||
}
|
||||
if (!(deployment_version && *deployment_version))
|
||||
{
|
||||
g_string_append_printf (title_key, ":%d", ostree_deployment_get_index (deployment));
|
||||
}
|
||||
|
||||
g_string_append_printf (title_key, ":%d", ostree_deployment_get_index (deployment));
|
||||
|
||||
g_string_append_c (title_key, ')');
|
||||
ostree_bootconfig_parser_set (bootconfig, "title", title_key->str);
|
||||
|
||||
|
||||
@@ -959,7 +959,18 @@ ostree_sysroot_load_if_changed (OstreeSysroot *self,
|
||||
}
|
||||
|
||||
if (self->root_is_ostree_booted && !self->booted_deployment)
|
||||
return glnx_throw (error, "Unexpected state: /run/ostree-booted found and in / sysroot but not in a booted deployment");
|
||||
{
|
||||
if (!glnx_fstatat_allow_noent (self->sysroot_fd, "boot/loader", NULL, AT_SYMLINK_NOFOLLOW, error))
|
||||
return FALSE;
|
||||
if (errno == ENOENT)
|
||||
{
|
||||
return glnx_throw (error, "Unexpected state: /run/ostree-booted found, but no /boot/loader directory");
|
||||
}
|
||||
else
|
||||
{
|
||||
return glnx_throw (error, "Unexpected state: /run/ostree-booted found and in / sysroot, but bootloader entry not found");
|
||||
}
|
||||
}
|
||||
|
||||
if (!_ostree_sysroot_reload_staged (self, error))
|
||||
return FALSE;
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
*
|
||||
* Since: 2017.4
|
||||
*/
|
||||
#define OSTREE_RELEASE_VERSION (3)
|
||||
#define OSTREE_RELEASE_VERSION (4)
|
||||
|
||||
/**
|
||||
* OSTREE_VERSION
|
||||
@@ -52,7 +52,7 @@
|
||||
*
|
||||
* Since: 2017.4
|
||||
*/
|
||||
#define OSTREE_VERSION (2019.3)
|
||||
#define OSTREE_VERSION (2019.4)
|
||||
|
||||
/**
|
||||
* OSTREE_VERSION_S:
|
||||
@@ -62,7 +62,7 @@
|
||||
*
|
||||
* Since: 2017.4
|
||||
*/
|
||||
#define OSTREE_VERSION_S "2019.3"
|
||||
#define OSTREE_VERSION_S "2019.4"
|
||||
|
||||
#define OSTREE_ENCODE_VERSION(year,release) \
|
||||
((year) << 16 | (release))
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gio/gunixoutputstream.h>
|
||||
#include "libglnx.h"
|
||||
|
||||
/* Like glnx_throw_errno_prefix, but takes @gpg_error */
|
||||
@@ -438,28 +439,102 @@ ot_gpgme_new_ctx (const char *homedir,
|
||||
return g_steal_pointer (&context);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_gnupg_version (guint *major,
|
||||
guint *minor,
|
||||
guint *patch)
|
||||
{
|
||||
g_return_val_if_fail (major != NULL, FALSE);
|
||||
g_return_val_if_fail (minor != NULL, FALSE);
|
||||
g_return_val_if_fail (patch != NULL, FALSE);
|
||||
|
||||
gpgme_engine_info_t info;
|
||||
gpgme_error_t err = gpgme_get_engine_info (&info);
|
||||
if (err != GPG_ERR_NO_ERROR)
|
||||
{
|
||||
g_debug ("Failed to get GPGME engine info: %s: %s",
|
||||
gpgme_strsource (err), gpgme_strerror (err));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const char *gnupg_version = NULL;
|
||||
for (; info != NULL; info = info->next)
|
||||
{
|
||||
if (info->protocol == GPGME_PROTOCOL_OpenPGP)
|
||||
{
|
||||
gnupg_version = info->version;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (gnupg_version == NULL)
|
||||
{
|
||||
g_debug ("Could not determine GnuPG version");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_auto(GStrv) parts = g_strsplit (gnupg_version, ".", 4);
|
||||
if (g_strv_length (parts) < 3)
|
||||
{
|
||||
g_debug ("Less than 3 components in GnuPG version \"%s\"", gnupg_version);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*major = g_ascii_strtoull (parts[0], NULL, 10);
|
||||
*minor = g_ascii_strtoull (parts[1], NULL, 10);
|
||||
*patch = g_ascii_strtoull (parts[2], NULL, 10);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ot_gpgme_kill_agent (const char *homedir)
|
||||
{
|
||||
g_return_if_fail (homedir != NULL);
|
||||
|
||||
/* If gnupg is at least 2.1.17, gpg-agent will exit when the homedir
|
||||
* is deleted.
|
||||
*/
|
||||
guint gnupg_major = 0, gnupg_minor = 0, gnupg_patch = 0;
|
||||
if (get_gnupg_version (&gnupg_major, &gnupg_minor, &gnupg_patch))
|
||||
{
|
||||
if ((gnupg_major > 2) ||
|
||||
(gnupg_major == 2 && gnupg_minor > 1) ||
|
||||
(gnupg_major == 2 && gnupg_minor == 1 && gnupg_patch >= 17))
|
||||
{
|
||||
/* Note early return */
|
||||
g_debug ("GnuPG >= 2.1.17, skipping gpg-agent cleanup in %s", homedir);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Run gpg-connect-agent killagent /bye */
|
||||
g_autoptr(GPtrArray) argv = g_ptr_array_new ();
|
||||
g_ptr_array_add (argv, "gpg-connect-agent");
|
||||
g_ptr_array_add (argv, "--homedir");
|
||||
g_ptr_array_add (argv, (gpointer)homedir);
|
||||
g_ptr_array_add (argv, "killagent");
|
||||
g_ptr_array_add (argv, "/bye");
|
||||
g_ptr_array_add (argv, NULL);
|
||||
|
||||
g_autoptr(GError) local_error = NULL;
|
||||
g_autoptr(GSubprocess) proc = g_subprocess_new(G_SUBPROCESS_FLAGS_STDOUT_SILENCE,
|
||||
&local_error,
|
||||
"gpg-connect-agent",
|
||||
"--homedir",
|
||||
homedir,
|
||||
"killagent",
|
||||
"/bye",
|
||||
NULL);
|
||||
if (proc == NULL) {
|
||||
g_debug ("Spawning gpg-connect-agent failed: %s", local_error->message);
|
||||
return;
|
||||
}
|
||||
if (!g_subprocess_wait_check (proc, NULL, &local_error)) {
|
||||
g_debug ("Killing GPG agent with gpg-connect-agent failed: %s",
|
||||
local_error->message);
|
||||
return;
|
||||
}
|
||||
GSpawnFlags flags = G_SPAWN_SEARCH_PATH | G_SPAWN_STDOUT_TO_DEV_NULL;
|
||||
gint proc_status = 0;
|
||||
g_autofree gchar *proc_stderr = NULL;
|
||||
g_debug ("Killing gpg-agent in %s", homedir);
|
||||
if (!g_spawn_sync (NULL, (char **)argv->pdata, NULL, flags, NULL, NULL,
|
||||
NULL, &proc_stderr, &proc_status, &local_error))
|
||||
{
|
||||
g_debug ("Spawning gpg-connect-agent failed: %s", local_error->message);
|
||||
return;
|
||||
}
|
||||
if (!g_spawn_check_exit_status (proc_status, &local_error))
|
||||
{
|
||||
/* Dump out stderr on failures */
|
||||
g_printerr ("%s", proc_stderr);
|
||||
|
||||
g_debug ("Killing GPG agent with gpg-connect-agent failed: %s",
|
||||
local_error->message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,7 @@ fsck_one_object (OstreeRepo *repo,
|
||||
if ((state & OSTREE_REPO_COMMIT_STATE_PARTIAL) == 0)
|
||||
{
|
||||
g_printerr ("Marking commit as partial: %s\n", parent_commit);
|
||||
if (!ostree_repo_mark_commit_partial (repo, parent_commit, TRUE, error))
|
||||
if (!ostree_repo_mark_commit_partial_reason (repo, parent_commit, TRUE, OSTREE_REPO_COMMIT_STATE_FSCK_PARTIAL, error))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -302,6 +302,7 @@ ostree_builtin_fsck (int argc, char **argv, OstreeCommandInvocation *invocation,
|
||||
opt_verify_bindings = TRUE;
|
||||
|
||||
guint n_partial = 0;
|
||||
guint n_fsck_partial = 0;
|
||||
g_hash_table_iter_init (&hash_iter, objects);
|
||||
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
||||
{
|
||||
@@ -410,7 +411,11 @@ ostree_builtin_fsck (int argc, char **argv, OstreeCommandInvocation *invocation,
|
||||
}
|
||||
|
||||
if (commitstate & OSTREE_REPO_COMMIT_STATE_PARTIAL)
|
||||
n_partial++;
|
||||
{
|
||||
n_partial++;
|
||||
if (commitstate & OSTREE_REPO_COMMIT_STATE_FSCK_PARTIAL)
|
||||
n_fsck_partial++;
|
||||
}
|
||||
else
|
||||
g_hash_table_add (commits, g_variant_ref (serialized_key));
|
||||
}
|
||||
@@ -450,5 +455,8 @@ ostree_builtin_fsck (int argc, char **argv, OstreeCommandInvocation *invocation,
|
||||
if (found_corruption)
|
||||
return glnx_throw (error, "Repository corruption encountered");
|
||||
|
||||
if (n_fsck_partial > 0)
|
||||
return glnx_throw (error, "%u partial commits from fsck-detected corruption", n_partial);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -273,6 +273,9 @@ main(int argc, char *argv[])
|
||||
|
||||
if (mount (".", root_mountpoint, NULL, MS_MOVE, NULL) < 0)
|
||||
err (EXIT_FAILURE, "failed to MS_MOVE %s to %s", deploy_path, root_mountpoint);
|
||||
|
||||
if (rmdir ("/sysroot.tmp") < 0)
|
||||
err (EXIT_FAILURE, "couldn't remove temporary sysroot /sysroot.tmp");
|
||||
}
|
||||
|
||||
/* The /sysroot mount needs to be private to avoid having a mount for e.g. /var/cache
|
||||
|
||||
Reference in new issue
Block a user