autoupdater: ignore minor compat-version

Ignore a mismatching minor compat-version. A minor version hints an
incompatibility with configuration, which Gluon re-generates based on
the intent on upgrade. Thus, only mismatching major versions present
a reason to block installation.

This is required to provide a migration path from swconfig to DSA based
ethernet architectures.

Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
David Bauer 2022-06-05 23:36:23 +02:00
parent 308166e3c6
commit b804281664
1 changed files with 4 additions and 2 deletions

View File

@ -382,11 +382,13 @@ static bool autoupdate(const char *mirror, struct settings *s, int lock_fd) {
{
static const char *const exec_builtin = "exec ";
static const char *const test_option = " --test ";
static const char *const compat_option = " --ignore-minor-compat-version ";
char buf[strlen(exec_builtin) + strlen(sysupgrade_path) + strlen(test_option) + strlen(firmware_path) + 1];
char buf[strlen(exec_builtin) + strlen(sysupgrade_path) + strlen(test_option) + strlen(compat_option) + strlen(firmware_path) + 1];
strcpy(buf, exec_builtin);
strcat(buf, sysupgrade_path);
strcat(buf, test_option);
strcat(buf, compat_option);
strcat(buf, firmware_path);
const int sysupgrade_ret = system(buf);
@ -416,7 +418,7 @@ static bool autoupdate(const char *mirror, struct settings *s, int lock_fd) {
/* Unset FD_CLOEXEC so the lockfile stays locked during sysupgrade */
fcntl(lock_fd, F_SETFD, 0);
execl(sysupgrade_path, sysupgrade_path, firmware_path, NULL);
execl(sysupgrade_path, sysupgrade_path, "--ignore-minor-compat-version", firmware_path, NULL);
/* execl() shouldn't return */
fputs("autoupdater: error: failed to call sysupgrade\n", stderr);