diff --git a/include/swupd.h b/include/swupd.h index b056f8ba..2a9c30bd 100644 --- a/include/swupd.h +++ b/include/swupd.h @@ -7,8 +7,8 @@ #include #include #include -#include #include +#include #include "list.h" #include "swupd-error.h" @@ -80,6 +80,7 @@ struct version_container { struct header; +extern bool allow_mix_collisions; extern bool verbose_time; extern bool force; extern bool migrate; diff --git a/src/globals.c b/src/globals.c index 19b11c9a..f637630a 100644 --- a/src/globals.c +++ b/src/globals.c @@ -30,7 +30,7 @@ #include "config.h" #include "swupd.h" - +bool allow_mix_collisions = false; bool force = false; bool migrate = false; bool sigcheck = true; diff --git a/src/main.c b/src/main.c index 721b8e39..b8293d4a 100644 --- a/src/main.c +++ b/src/main.c @@ -54,6 +54,7 @@ static const struct option prog_opts[] = { { "no-scripts", no_argument, 0, 'N' }, { "no-boot-update", no_argument, 0, 'b' }, { "migrate", no_argument, 0, 'b' }, + { "allow-mix-collisions", no_argument, 0, 'a' }, { 0, 0, 0, 0 } }; @@ -91,12 +92,15 @@ static bool parse_options(int argc, char **argv) { int opt; - while ((opt = getopt_long(argc, argv, "hxnIdtNbmu:P:c:v:sF:p:S:C:", prog_opts, NULL)) != -1) { + while ((opt = getopt_long(argc, argv, "hxnIdtNbmau:P:c:v:sF:p:S:C:", prog_opts, NULL)) != -1) { switch (opt) { case '?': case 'h': print_help(argv[0]); exit(EXIT_SUCCESS); + case 'a': + allow_mix_collisions = true; + break; case 'd': download_only = true; break; diff --git a/src/manifest.c b/src/manifest.c index a4594542..23f193ee 100644 --- a/src/manifest.c +++ b/src/manifest.c @@ -1546,5 +1546,5 @@ int enforce_compliant_manifest(struct file **a, struct file **b, int searchsize, ret++; } } - return ret; // No collisions were found, so manifest is purely additive + return ret; // If collisions were found, so manifest is purely additive } diff --git a/src/update.c b/src/update.c index 2a69389d..04e188a2 100644 --- a/src/update.c +++ b/src/update.c @@ -368,6 +368,10 @@ version_check: ret = check_manifests_uniqueness(server_version, mix_server_version); if (ret) { printf("\n\t!! %i collisions were found between mix and upstream, please re-create mix !!\n", ret); + if (!allow_mix_collisions) { + ret = EXIT_FAILURE; + goto clean_curl; + } } /* Update the clearversion that will be used to generate the new mix content */