mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-23 11:36:32 +01:00
refactor(rootfs): [not tested, big change]replace guix-specific flag with generic EXTRA_BUILDS and steps-* extension flow
This commit is contained in:
parent
c75e951627
commit
4dc0135455
3 changed files with 167 additions and 78 deletions
|
|
@ -17,17 +17,27 @@ if [ -d /steps/after ]; then
|
|||
done
|
||||
fi
|
||||
|
||||
if [ "${BUILD_GUIX_ALSO}" = True ]; then
|
||||
if [ ! -f /steps-guix/manifest ]; then
|
||||
echo "BUILD_GUIX_ALSO is True but /steps-guix/manifest is missing." >&2
|
||||
exit 1
|
||||
fi
|
||||
extra_builds="${EXTRA_BUILDS:-}"
|
||||
# Backward compatibility for older bootstrap.cfg.
|
||||
if [ -z "${extra_builds}" ] && [ "${BUILD_GUIX_ALSO}" = True ]; then
|
||||
extra_builds="guix"
|
||||
fi
|
||||
|
||||
sed -i '/^BUILD_GUIX_ALSO=/d' /steps/bootstrap.cfg
|
||||
echo 'BUILD_GUIX_ALSO=False' >> /steps/bootstrap.cfg
|
||||
|
||||
/script-generator /steps-guix/manifest /steps
|
||||
bash /steps-guix/0.sh
|
||||
if [ -n "${extra_builds}" ]; then
|
||||
old_ifs="${IFS}"
|
||||
IFS=','
|
||||
for extra_build in ${extra_builds}; do
|
||||
[ -n "${extra_build}" ] || continue
|
||||
extra_manifest="/steps-${extra_build}/manifest"
|
||||
if [ ! -f "${extra_manifest}" ]; then
|
||||
echo "EXTRA_BUILDS includes '${extra_build}' but ${extra_manifest} is missing." >&2
|
||||
IFS="${old_ifs}"
|
||||
exit 1
|
||||
fi
|
||||
/script-generator "${extra_manifest}" /steps
|
||||
bash "/steps-${extra_build}/0.sh"
|
||||
done
|
||||
IFS="${old_ifs}"
|
||||
fi
|
||||
|
||||
if [ "${INTERACTIVE}" = True ]; then
|
||||
|
|
|
|||
|
|
@ -119,30 +119,39 @@ if [ "${CHROOT}" = False ]; then
|
|||
fi
|
||||
EOF
|
||||
|
||||
if [ "${BUILD_GUIX_ALSO}" = True ]; then
|
||||
cat >> /init <<- 'EOF'
|
||||
run_steps_guix_if_requested() {
|
||||
if [ "${BUILD_GUIX_ALSO}" != True ]; then
|
||||
return 1
|
||||
run_extra_builds_if_requested() {
|
||||
extra_builds="${EXTRA_BUILDS:-}"
|
||||
# Backward compatibility for older bootstrap.cfg.
|
||||
if [ -z "${extra_builds}" ] && [ "${BUILD_GUIX_ALSO}" = True ]; then
|
||||
extra_builds="guix"
|
||||
fi
|
||||
if [ ! -f /steps-guix/manifest ]; then
|
||||
echo "BUILD_GUIX_ALSO is True but /steps-guix/manifest is missing." >&2
|
||||
return 1
|
||||
if [ -z "${extra_builds}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
sed -i '/^BUILD_GUIX_ALSO=/d' /steps/bootstrap.cfg
|
||||
echo 'BUILD_GUIX_ALSO=False' >> /steps/bootstrap.cfg
|
||||
|
||||
/script-generator /steps-guix/manifest /steps
|
||||
bash /steps-guix/0.sh
|
||||
return $?
|
||||
old_ifs="${IFS}"
|
||||
IFS=','
|
||||
for extra_build in ${extra_builds}; do
|
||||
[ -n "${extra_build}" ] || continue
|
||||
extra_manifest="/steps-${extra_build}/manifest"
|
||||
if [ ! -f "${extra_manifest}" ]; then
|
||||
echo "EXTRA_BUILDS includes '${extra_build}' but ${extra_manifest} is missing." >&2
|
||||
IFS="${old_ifs}"
|
||||
return 1
|
||||
fi
|
||||
/script-generator "${extra_manifest}" /steps
|
||||
bash "/steps-${extra_build}/0.sh" || {
|
||||
IFS="${old_ifs}"
|
||||
return 1
|
||||
}
|
||||
done
|
||||
IFS="${old_ifs}"
|
||||
return 0
|
||||
}
|
||||
|
||||
if [ "${BUILD_GUIX_ALSO}" = True ]; then
|
||||
run_steps_guix_if_requested || shutdown_system $?
|
||||
fi
|
||||
run_extra_builds_if_requested || shutdown_system $?
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat >> /init <<- 'EOF'
|
||||
if [ "${QEMU}" = True ] && [ "${BARE_METAL}" = False ]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue