summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-sysroot-upgrader.h
blob: 5d1e8c2aa57739b9b98dcc17e4a1169b9fd0457a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
 * Copyright (C) 2014 Colin Walters <walters@verbum.org>
 *
 * SPDX-License-Identifier: LGPL-2.0+
 *
 * This library 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 License, 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, see <https://www.gnu.org/licenses/>.
 */

#pragma once

#include "ostree-sysroot.h"

G_BEGIN_DECLS

#define OSTREE_TYPE_SYSROOT_UPGRADER ostree_sysroot_upgrader_get_type ()
#define OSTREE_SYSROOT_UPGRADER(obj) \
  (G_TYPE_CHECK_INSTANCE_CAST ((obj), OSTREE_TYPE_SYSROOT_UPGRADER, OstreeSysrootUpgrader))
#define OSTREE_IS_SYSROOT_UPGRADER(obj) \
  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OSTREE_TYPE_SYSROOT_UPGRADER))

/**
 * OstreeSysrootUpgraderFlags:
 * @OSTREE_SYSROOT_UPGRADER_FLAGS_NONE: No options
 * @OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED: Do not error if the origin has an
 * unconfigured-state key
 * @OSTREE_SYSROOT_UPGRADER_FLAGS_STAGE: Enable "staging" (finalization at shutdown); recommended
 *    (Since: 2021.4)
 *
 * Flags controlling operation of an #OstreeSysrootUpgrader.
 */
typedef enum
{
  OSTREE_SYSROOT_UPGRADER_FLAGS_NONE = (1 << 0),
  OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED = (1 << 1),
  OSTREE_SYSROOT_UPGRADER_FLAGS_STAGE = (1 << 2),
} OstreeSysrootUpgraderFlags;

_OSTREE_PUBLIC
GType ostree_sysroot_upgrader_get_type (void);

_OSTREE_PUBLIC
GType ostree_sysroot_upgrader_flags_get_type (void);

_OSTREE_PUBLIC
OstreeSysrootUpgrader *ostree_sysroot_upgrader_new (OstreeSysroot *sysroot,
                                                    GCancellable *cancellable, GError **error);

_OSTREE_PUBLIC
OstreeSysrootUpgrader *ostree_sysroot_upgrader_new_for_os (OstreeSysroot *sysroot,
                                                           const char *osname,
                                                           GCancellable *cancellable,
                                                           GError **error);

_OSTREE_PUBLIC
OstreeSysrootUpgrader *
ostree_sysroot_upgrader_new_for_os_with_flags (OstreeSysroot *sysroot, const char *osname,
                                               OstreeSysrootUpgraderFlags flags,
                                               GCancellable *cancellable, GError **error);

_OSTREE_PUBLIC
GKeyFile *ostree_sysroot_upgrader_get_origin (OstreeSysrootUpgrader *self);
_OSTREE_PUBLIC
GKeyFile *ostree_sysroot_upgrader_dup_origin (OstreeSysrootUpgrader *self);
_OSTREE_PUBLIC
gboolean ostree_sysroot_upgrader_set_origin (OstreeSysrootUpgrader *self, GKeyFile *origin,
                                             GCancellable *cancellable, GError **error);

_OSTREE_PUBLIC
char *ostree_sysroot_upgrader_get_origin_description (OstreeSysrootUpgrader *self);

_OSTREE_PUBLIC
gboolean ostree_sysroot_upgrader_check_timestamps (OstreeRepo *repo, const char *from_rev,
                                                   const char *to_rev, GError **error);

typedef enum
{
  OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_NONE = 0,
  OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_ALLOW_OLDER = (1 << 0),
  OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_SYNTHETIC
  = (1 << 1) /* Don't actually do a pull, just check timestamps/changed */
} OstreeSysrootUpgraderPullFlags;

_OSTREE_PUBLIC
gboolean ostree_sysroot_upgrader_pull (OstreeSysrootUpgrader *self, OstreeRepoPullFlags flags,
                                       OstreeSysrootUpgraderPullFlags upgrader_flags,
                                       OstreeAsyncProgress *progress, gboolean *out_changed,
                                       GCancellable *cancellable, GError **error);

_OSTREE_PUBLIC
gboolean ostree_sysroot_upgrader_pull_one_dir (OstreeSysrootUpgrader *self, const char *dir_to_pull,
                                               OstreeRepoPullFlags flags,
                                               OstreeSysrootUpgraderPullFlags upgrader_flags,
                                               OstreeAsyncProgress *progress, gboolean *out_changed,
                                               GCancellable *cancellable, GError **error);

_OSTREE_PUBLIC
gboolean ostree_sysroot_upgrader_deploy (OstreeSysrootUpgrader *self, GCancellable *cancellable,
                                         GError **error);

G_END_DECLS