Fix tix3g migration hook installing the wrong PLATFORM in collection.conf.

This commit is contained in:
Jonas 'Sortie' Termansen 2023-08-21 23:53:25 +02:00
parent 7e8b7f15d3
commit 49f643fe90
2 changed files with 7 additions and 5 deletions

View File

@ -61,7 +61,7 @@ install: all
touch $(DESTDIR)$(DATADIR)/sysinstall/hooks/sortix-1.1-init
touch $(DESTDIR)$(DATADIR)/sysinstall/hooks/sortix-1.1-passwd
touch $(DESTDIR)$(DATADIR)/sysinstall/hooks/sortix-1.1-group
touch $(DESTDIR)$(DATADIR)/sysinstall/hooks/sortix-1.1-tix-3g
touch $(DESTDIR)$(DATADIR)/sysinstall/hooks/sortix-1.1-tix3g
touch $(DESTDIR)$(DATADIR)/sysinstall/hooks/sortix-1.1-grub-cache
sysinstall: $(SYSINSTALL_OBJS)

View File

@ -427,7 +427,7 @@ void upgrade_prepare(const struct release* old_release,
// TODO: After releasing Sortix 1.1, remove this compatibility.
if ( hook_needs_to_be_run(source_prefix, target_prefix,
"sortix-1.1-tix-3g") )
"sortix-1.1-tix3g") )
{
char* path = join_paths(target_prefix, "/tix/collection.conf");
if ( !path )
@ -441,6 +441,8 @@ void upgrade_prepare(const struct release* old_release,
printf(" - Migrating to tix version 3...\n");
struct utsname uts;
uname(&uts);
for ( size_t i = 0; uts.sysname[i]; i++ )
uts.sysname[i] = tolower((unsigned char) uts.sysname[i]);
if ( fprintf(fp, "TIX_COLLECTION_VERSION=3\n") < 0 ||
fprintf(fp, "PREFIX=\n") < 0 ||
fprintf(fp, "PLATFORM=%s-%s\n",
@ -458,7 +460,7 @@ void upgrade_prepare(const struct release* old_release,
}
free(path);
// Delay deleting installed.list since it's needed for the upgrade.
hook_want_finalization(target_prefix, "sortix-1.1-tix-3g");
hook_want_finalization(target_prefix, "sortix-1.1-tix3g");
}
// TODO: After releasing Sortix 1.1, remove this compatibility.
@ -496,7 +498,7 @@ void upgrade_finalize(const struct release* old_release,
(void) source_prefix;
(void) target_prefix;
if ( hook_needs_finalization(target_prefix, "sortix-1.1-tix-3g") )
if ( hook_needs_finalization(target_prefix, "sortix-1.1-tix3g") )
{
printf(" - Finishing migration to tix version 3...\n");
char* path = join_paths(target_prefix, "/tix/installed.list");
@ -523,7 +525,7 @@ void upgrade_finalize(const struct release* old_release,
_exit(2);
}
free(path);
hook_did_finalization(target_prefix, "sortix-1.1-tix-3g");
hook_did_finalization(target_prefix, "sortix-1.1-tix3g");
}
}