Remove the notion of "sys*"

- This idea originates from very early in the project and was, at the
  time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
  occuring when there is a change in kernel, but not from builder-hex0
  to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
  more difficult to understand.
- This puts everything down into one folder and has a manifest file that
  is used to generate the build scripts on the fly rather than using
  coded scripts.
- This is created in the "seed" stage.

stage0-posix -- (calls) --> seed -- (generates) --> main steps

Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.

- Creating a rootfs has become much simpler and is defined as code in
  go.sh. The new structure, for an about-to-be booted system, is

/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*

- There is no longer such a thing as /usr/include/musl, this didn't
  really make any sense, as musl is the final libc used. Rather, to
  separate musl and mes, we have /usr/include/mes, which is much easier
  to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
  checksum-transcriber, simple-patch, kexec-fiwix have all been given
  fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
  but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
  etc. This avoids manual definition of passes.
  - Ditto with patches; default directory is patches, but then any patch
    series specific to a pass are named patches-passX.
This commit is contained in:
fosslinux 2023-11-07 10:51:23 +11:00
parent 0907cfd073
commit 6ed2e09f3a
546 changed files with 700 additions and 1299 deletions

View file

@ -0,0 +1 @@
4d1a7b8a0e42f278df20893610dd37dec62b609c2c342d9252917907e4d73c03 /usr/bin/checksum-transcriber

View file

@ -0,0 +1 @@
b6145df4b2a92d5ee75902f4367e7a1a5456a5cef7a2e1365610637b054c477a /usr/bin/checksum-transcriber

View file

@ -0,0 +1 @@
216fe50dd8e70928f382d40ced1d9a2c167f7a5aafd555901194c5559af8c526 /usr/bin/checksum-transcriber

View file

@ -0,0 +1,20 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
#
# SPDX-License-Identifier: GPL-3.0-or-later
set -ex
# Build & install
M2-Mesoplanet --architecture ${ARCH} -f src/checksum-transcriber.c -o ${BINDIR}/checksum-transcriber
# Checksums
if match x${UPDATE_CHECKSUMS} xTrue; then
sha256sum -o ${pkg}.${ARCH}.checksums \
/usr/bin/checksum-transcriber
cp ${pkg}.${ARCH}.checksums ${SRCDIR}
else
sha256sum -c ${pkg}.${ARCH}.checksums
fi

View file

@ -0,0 +1,90 @@
/*
* SPDX-FileCopyrightText: 2022 fosslinux <fosslinux@aussies.space>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <bootstrappable.h>
#include <unistd.h>
#define MAX_STRING 4096
#define MAX_TOKENS 3
char *get_distfiles(char **envp) {
char *envvar = "DISTFILES=";
int i = 0;
while (envp[i] != NULL && strncmp(envp[i], envvar, strlen(envvar)) != 0) i += 1;
// Now we have distfiles= - get just the part we want.
require(envp[i] != NULL, "Unable to find distfiles environment variable");
return envp[i] + strlen(envvar);
}
int main(int argc, char **argv, char **envp) {
// Random file things
require(argc == 2, "Usage: checksum-transcriber FILENAME");
char *input = argv[1];
FILE *in = fopen(input, "r");
require(in != NULL, "File does not exist");
char *output = calloc(MAX_STRING, sizeof(char));
require(strcpy(output, input) != NULL, "Failed copying string");
require(strcat(output, ".SHA256SUM") != NULL, "Failed concating string");
FILE *out = fopen(output, "w+");
require(out != NULL, "Failed opening output file");
char *orig_line;
char *line = calloc(MAX_STRING, sizeof(char));
require(line != NULL, "Failed allocating string");
char **tokens;
char *new_line;
char *checksum;
char *filename;
int i;
fgets(line, MAX_STRING, in);
while (strlen(line) != 0) {
// Split each line into tokens
orig_line = line;
tokens = calloc(MAX_TOKENS, sizeof(char*));
i = 0;
while (i < MAX_TOKENS) {
tokens[i] = line;
new_line = strchr(line, ' ');
// Occurs when there are only two tokens
if (new_line == NULL) break;
line = new_line;
line[0] = '\0';
line += 1;
i += 1;
}
line = strchr(line, '\n');
line[0] = '\0';
// Get checksum and filename
checksum = tokens[1];
if (tokens[2] != NULL) {
filename = tokens[2];
} else {
filename = strrchr(tokens[0], '/');
filename += 1;
}
// Put it all together
fputs(checksum, out);
fputs(" ", out);
fputs(get_distfiles(envp), out);
fputc('/', out);
fputs(filename, out);
fputc('\n', out);
// Cleanup
i = 0;
free(orig_line);
free(tokens);
line = calloc(MAX_STRING, sizeof(char));
require(line != NULL, "Failed allocating string");
fgets(line, MAX_STRING, in);
}
// Clean up
fclose(in);
fclose(out);
}