File: install.h

package info (click to toggle)
rauc 1.15-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,336 kB
  • sloc: ansic: 36,989; python: 3,354; sh: 1,391; xml: 53; makefile: 41
file content (157 lines) | stat: -rw-r--r-- 3,861 bytes parent folder | download | duplicates (2)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#pragma once

#include <glib.h>

#include "artifacts.h"
#include "bundle.h"
#include "manifest.h"
#include "slot.h"
#include "update_handler.h"

#define R_INSTALL_ERROR r_install_error_quark()
GQuark r_install_error_quark(void);

typedef enum {
	R_INSTALL_ERROR_FAILED,
	R_INSTALL_ERROR_COMPAT_MISMATCH,
	R_INSTALL_ERROR_VERSION_MISMATCH,
	R_INSTALL_ERROR_REJECTED,
	R_INSTALL_ERROR_MARK_BOOTABLE,
	R_INSTALL_ERROR_MARK_NONBOOTABLE,
	R_INSTALL_ERROR_TARGET_GROUP,
	R_INSTALL_ERROR_MOUNTED,
} RInstallError;

typedef struct {
	gchar *name;
	GSourceFunc notify;
	GSourceFunc cleanup;
	GMutex status_mutex;
	GQueue status_messages;
	gint status_result;

	/* install options */
	gboolean ignore_compatible;
	gboolean ignore_version_limit;
	gchar *require_manifest_hash;
	gchar *transaction;
	RaucBundleAccessArgs access_args;
} RaucInstallArgs;

/**
 * Update the external mount points of a slot.
 *
 * @param error return location for a GError
 *
 * @return TRUE if succeeded, FALSE if failed
 */
gboolean update_external_mount_points(GError **error)
G_GNUC_WARN_UNUSED_RESULT;

/**
 * Determines the states (ACTIVE | INACTIVE | BOOTED) of the slots specified in
 * system configuration.
 *
 * @param error return location for a GError
 *
 * @return TRUE if succeeded, FALSE if failed
 */
gboolean determine_slot_states(GError **error)
G_GNUC_WARN_UNUSED_RESULT;

/**
 * Obtains boot status information for all relevant slots and stores
 * information into context.
 *
 * @param error return location for a GError
 *
 * @return TRUE if succeeded, FALSE if failed
 */
gboolean determine_boot_states(GError **error)
G_GNUC_WARN_UNUSED_RESULT;

/**
 * Returns hash table of slot classes for that a potential installation target
 * slot could be determined.
 *
 * @return GHashTable mapping a slotclass (gchar*) to a slot instance
 * (RaucSlot*)
 */
GHashTable* determine_target_install_group(void)
G_GNUC_WARN_UNUSED_RESULT;

/**
 * Basic bundle installation procedure.
 *
 * @param args RaucInstallArgs instance
 * @param error return location for a GError
 *
 * @return TRUE if installation succeeded, FALSE if any critical error occurred
 */
gboolean do_install_bundle(RaucInstallArgs *args, GError **error)
G_GNUC_WARN_UNUSED_RESULT;

/**
 * Initialize new RaucInstallArgs structure
 *
 * @return returns newly allocated RaucInstallArgs.
 *         Free with install_args_free.
 */
RaucInstallArgs *install_args_new(void)
G_GNUC_WARN_UNUSED_RESULT;

/**
 * Free allocated RaucInstallArgs structure
 *
 * @param args instance to free
 */
void install_args_free(RaucInstallArgs *args);

/**
 * Start a new installer thread.
 *
 * Internally, this uses g_thread_new(), which aborts on error. If we can't
 * start threads, we can't recover anyway.
 *
 * @param args RaucInstallArgs instance
 */
void install_run(RaucInstallArgs *args);

typedef struct {
	RaucImage *image;

	RaucSlot *target_slot;
	img_to_slot_handler slot_handler;

	RArtifactRepo *target_repo;
} RImageInstallPlan;

void r_image_install_plan_free(gpointer value);

/**
 * Builds and returns an array of RImageInstallPlans.
 *
 * Check is performed against target_group.
 *
 * NOTE: This function might be extended to perform further selection on
 * install images later on.
 *
 * @param manifest manifest to obtain install images from
 * @param target_group target group to verify against
 * @param error Return location for a GError
 *
 * @return Returns GPtrArray of RImageInstallPlans
 *         or NULL if an error occurred
 */
GPtrArray* r_install_make_plans(const RaucManifest *manifest, GHashTable *target_group, GError **error)
G_GNUC_WARN_UNUSED_RESULT;

/**
 * Checks if header is supported.
 *
 * @param header Header config name to check
 *
 * @return TRUE if is supported, FALSE otherwise
 */
gboolean r_install_is_supported_http_header(const gchar *header)
G_GNUC_WARN_UNUSED_RESULT;