Skip to content

Commit

Permalink
Merge pull request #93 from ejoerns/v0/topic/force-compatible
Browse files Browse the repository at this point in the history
introduce rauc install --ignore-compatible switch
  • Loading branch information
jluebbe committed Jan 30, 2017
2 parents 21670e4 + 6205a31 commit 3e80052
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ typedef struct {

/* optional custom handler extra arguments */
gchar *handlerextra;
/* ignore compatible check */
gboolean ignore_compatible;
} RaucContext;

typedef struct {
Expand Down
4 changes: 3 additions & 1 deletion src/install.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,9 @@ static void parse_handler_output(gchar* line) {
}

static gboolean verify_compatible(RaucManifest *manifest) {
if (g_strcmp0(r_context()->config->system_compatible,
if (r_context()->ignore_compatible) {
return TRUE;
} else if (g_strcmp0(r_context()->config->system_compatible,
manifest->update_compatible) == 0) {
return TRUE;
} else {
Expand Down
12 changes: 11 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
GMainLoop *r_loop = NULL;
int r_exit_status = 0;

gboolean install_ignore_compatible = FALSE;
gboolean info_noverify = FALSE;
gchar *output_format = NULL;

Expand Down Expand Up @@ -132,6 +133,8 @@ static gboolean install_start(int argc, char **argv)
args->cleanup = install_cleanup;
args->status_result = 2;

r_context_conf()->ignore_compatible = install_ignore_compatible;

r_loop = g_main_loop_new(NULL, FALSE);
if (ENABLE_SERVICE) {
installer = r_installer_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,
Expand Down Expand Up @@ -866,6 +869,11 @@ typedef struct {
gboolean while_busy;
} RaucCommand;

GOptionEntry entries_install[] = {
{"ignore-compatible", '\0', 0, G_OPTION_ARG_NONE, &install_ignore_compatible, "disable compatible check", NULL},
{0}
};

GOptionEntry entries_info[] = {
{"no-verify", '\0', 0, G_OPTION_ARG_NONE, &info_noverify, "disable bundle verification", NULL},
{"output-format", '\0', 0, G_OPTION_ARG_STRING, &output_format, "output format", "FORMAT"},
Expand Down Expand Up @@ -895,6 +903,7 @@ static void cmdline_handler(int argc, char **argv)
{"help", 'h', 0, G_OPTION_ARG_NONE, &help, NULL, NULL},
{0}
};
GOptionGroup *install_group = g_option_group_new("install", "Install options:", "help dummy", NULL, NULL);
GOptionGroup *info_group = g_option_group_new("info", "Info options:", "help dummy", NULL, NULL);
GOptionGroup *status_group = g_option_group_new("status", "Status options:", "help dummy", NULL, NULL);

Expand All @@ -903,7 +912,7 @@ static void cmdline_handler(int argc, char **argv)

RaucCommand rcommands[] = {
{UNKNOWN, "help", "<COMMAND>", unknown_start, NULL, TRUE},
{INSTALL, "install", "install <BUNDLE>", install_start, NULL, FALSE},
{INSTALL, "install", "install <BUNDLE>", install_start, install_group, FALSE},
{BUNDLE, "bundle", "bundle <FILE>", bundle_start, NULL, FALSE},
{CHECKSUM, "checksum", "checksum <DIRECTORY>", checksum_start, NULL, FALSE},
{INFO, "info", "info <FILE>", info_start, info_group, FALSE},
Expand All @@ -916,6 +925,7 @@ static void cmdline_handler(int argc, char **argv)
RaucCommand *rc;
RaucCommand *rcommand = NULL;

g_option_group_add_entries(install_group, entries_install);
g_option_group_add_entries(info_group, entries_info);
g_option_group_add_entries(status_group, entries_status);

Expand Down

0 comments on commit 3e80052

Please sign in to comment.