Add minimal unprivileged bootstrap

This commit is contained in:
MaxHearnden 2024-09-10 05:57:49 +01:00
parent 1f272f9050
commit f3828e44db
7 changed files with 66 additions and 10 deletions

19
seed/after-wrap.kaem Normal file
View file

@ -0,0 +1,19 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2024 Max Hearnden maxoscarhearnden@gmail.com
#
# SPDX-License-Identifier: GPL-3.0-or-later
set -ex
# detect wether we are in a rootfs.py environment
if ./${ARCH_DIR}/bin/catm steps/env-saved steps/env; then
./${ARCH_DIR}/bin/wrap /${ARCH_DIR}/bin/kaem --file after-wrapped.kaem
else
# leave seed/stage0-posix
cd ../..
ARCH_DIR=seed/stage0-posix/${ARCH_DIR}
./${ARCH_DIR}/bin/wrap /${ARCH_DIR}/bin/kaem --file seed/after.kaem
fi

View file

@ -11,5 +11,18 @@ set -ex
PATH=/${ARCH_DIR}/bin
catm seed-full.kaem /steps/bootstrap.cfg /steps/env seed.kaem
if catm seed-full.kaem /steps/bootstrap.cfg /steps/env seed.kaem; then
else
replace --file /steps/env --output /steps/env --match-on /external/distfiles --replace-with /distfiles
cp /seed/wrap-bootstrap.cfg /steps/bootstrap.cfg
catm seed-full.kaem /steps/bootstrap.cfg /steps/env /seed/seed.kaem
cp /seed/configurator.c configurator.c
cp /seed/configurator.${ARCH}.checksums configurator.${ARCH}.checksums
cp /seed/script-generator.c script-generator.c
cp /seed/script-generator.${ARCH}.checksums script-generator.${ARCH}.checksums
# placeholder value
FINAL_JOBS=1
fi
kaem --file seed-full.kaem

View file

@ -64,7 +64,12 @@ MES_PKG=mes-0.27
MES_PREFIX=${SRCDIR}/${MES_PKG}/build/${MES_PKG}
GUILE_LOAD_PATH=${MES_PREFIX}/mes/module:${MES_PREFIX}/module:${SRCDIR}/${MES_PKG}/build/${NYACC_PKG}/module
M2-Mesoplanet --architecture ${ARCH} -f configurator.c -o configurator
if M2-Mesoplanet --architecture ${ARCH} -f configurator.c -o configurator; then
else
# using lightweight wrapper
M2LIBC_PATH=/seed/stage0-posix/M2libc
M2-Mesoplanet --architecture ${ARCH} -f configurator.c -o configurator
fi
# Checksums
if match x${UPDATE_CHECKSUMS} xTrue; then
sha256sum -o configurator.${ARCH}.checksums configurator

5
seed/wrap-bootstrap.cfg Normal file
View file

@ -0,0 +1,5 @@
CHROOT=True
DISK=sda1
KERNEL_BOOTSTRAP=False
BUILD_KERNELS=False
JOBS=${FINAL_JOBS}