This fixes installboot regress on powerpc64, forgot to send it earlier.
The same diff already landed for macppc; efi already the same fix
md_init() but without the cleanup that entails for macppc and powerpc64.
>From macppc_installboot.c r1.6 "Fix passing explicit stage files":
Using `stage1' leads to a bit more cleanup since early MI installboot.c
handles `-r', i.e. write_filesystem() no longer has needs to do the
fileprefix() dance itself.
OK?
Index: powerpc64_installboot.c
===================================================================
RCS file: /cvs/src/usr.sbin/installboot/powerpc64_installboot.c,v
retrieving revision 1.5
diff -u -p -r1.5 powerpc64_installboot.c
--- powerpc64_installboot.c 9 Sep 2022 15:53:16 -0000 1.5
+++ powerpc64_installboot.c 12 Sep 2022 12:31:44 -0000
@@ -63,6 +63,8 @@ char duid[20];
void
md_init(void)
{
+ stages = 1;
+ stage1 = "/usr/mdec/boot";
}
void
@@ -172,12 +174,9 @@ write_filesystem(struct disklabel *dl, c
char cmd[60];
char dir[PATH_MAX];
char dst[PATH_MAX];
- char *src;
- size_t mntlen, srclen;
+ size_t mntlen;
int rslt;
- src = NULL;
-
/* Create directory for temporary mount point. */
strlcpy(dir, "/tmp/installboot.XXXXXXXXXX", sizeof(dst));
if (mkdtemp(dir) == NULL)
@@ -239,17 +238,11 @@ write_filesystem(struct disklabel *dl, c
warn("unable to build /boot path");
goto umount;
}
- src = fileprefix(root, "/usr/mdec/boot");
- if (src == NULL) {
- rslt = -1;
- goto umount;
- }
- srclen = strlen(src);
if (verbose)
fprintf(stderr, "%s %s to %s\n",
- (nowrite ? "would copy" : "copying"), src, dst);
+ (nowrite ? "would copy" : "copying"), stage1, dst);
if (!nowrite) {
- rslt = filecopy(src, dst);
+ rslt = filecopy(stage1, dst);
if (rslt == -1)
goto umount;
}
@@ -292,8 +285,6 @@ rmdir:
dst[mntlen] = '\0';
if (rmdir(dir) == -1)
err(1, "rmdir('%s') failed", dir);
-
- free(src);
if (rslt == -1)
exit(1);