From ef7127bb83c14b20bfdaea4751752e8d3a223e63 Mon Sep 17 00:00:00 2001 From: vxtls <187420201+vxtls@users.noreply.github.com> Date: Thu, 26 Feb 2026 09:40:35 -0500 Subject: [PATCH] fix(bootstrap): fix guile-gnutls static libtool target and make init fail-safe without panic --- .../{gnutls-3.8.0 => gnutls-3.8.12}/pass1.sh | 0 .../{gnutls-3.8.0 => gnutls-3.8.12}/sources | 0 .../patches/static-no-so.patch | 18 +++----- steps-guix/manifest | 5 ++- steps/improve/make_bootable.sh | 42 +++++++++++++------ 5 files changed, 39 insertions(+), 26 deletions(-) rename steps-guix/{gnutls-3.8.0 => gnutls-3.8.12}/pass1.sh (100%) rename steps-guix/{gnutls-3.8.0 => gnutls-3.8.12}/sources (100%) diff --git a/steps-guix/gnutls-3.8.0/pass1.sh b/steps-guix/gnutls-3.8.12/pass1.sh similarity index 100% rename from steps-guix/gnutls-3.8.0/pass1.sh rename to steps-guix/gnutls-3.8.12/pass1.sh diff --git a/steps-guix/gnutls-3.8.0/sources b/steps-guix/gnutls-3.8.12/sources similarity index 100% rename from steps-guix/gnutls-3.8.0/sources rename to steps-guix/gnutls-3.8.12/sources diff --git a/steps-guix/guile-gnutls-v5.0.1/patches/static-no-so.patch b/steps-guix/guile-gnutls-v5.0.1/patches/static-no-so.patch index 78da01fb..4cea883d 100644 --- a/steps-guix/guile-gnutls-v5.0.1/patches/static-no-so.patch +++ b/steps-guix/guile-gnutls-v5.0.1/patches/static-no-so.patch @@ -1,5 +1,5 @@ --- guile-gnutls-v5.0.1/configure.ac 2025-07-13 09:01:47 -+++ guile-gnutls-v5.0.1/configure.ac 2026-02-25 20:59:39 ++++ guile-gnutls-v5.0.1/configure.ac 2026-02-26 09:33:42 @@ -37,7 +37,7 @@ AC_PROG_CC AC_PROG_CPP @@ -26,7 +26,7 @@ AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = "xyes"]) AM_CONDITIONAL(HAVE_GCC_GNU89_INLINE_OPTION, test "$gnu89_inline" = "yes"]) --- guile-gnutls-v5.0.1/guile/Makefile.am 2025-07-13 09:01:47 -+++ guile-gnutls-v5.0.1/guile/Makefile.am 2026-02-25 20:59:39 ++++ guile-gnutls-v5.0.1/guile/Makefile.am 2026-02-26 09:33:42 @@ -46,6 +46,7 @@ .in.scm: $(AM_V_GEN)$(MKDIR_P) "`dirname "$@"`" ; cat "$^" | \ @@ -49,7 +49,7 @@ # Make sure 'gnutls.scm' is built first. # Unset 'GUILE_LOAD_COMPILED_PATH' so we can be sure that any .go file that we --- guile-gnutls-v5.0.1/guile/modules/gnutls.in 2025-07-13 09:01:47 -+++ guile-gnutls-v5.0.1/guile/modules/gnutls.in 2026-02-25 20:59:39 ++++ guile-gnutls-v5.0.1/guile/modules/gnutls.in 2026-02-26 09:33:43 @@ -817,7 +817,8 @@ ;; save 'extensiondir' only if it's different from what Guile expects. @maybe_guileextensiondir@)) @@ -71,20 +71,14 @@ (set! protocol/ssl-3 protocol/ssl3) (set! protocol/tls-1.0 protocol/tls1-0) --- guile-gnutls-v5.0.1/guile/src/Makefile.am 2025-07-13 09:01:47 -+++ guile-gnutls-v5.0.1/guile/src/Makefile.am 2026-02-25 20:59:39 -@@ -35,12 +35,17 @@ - - CLEANFILES = $(BUILT_SOURCES) - -+if BUILD_SHARED - guileextension_LTLIBRARIES = guile-gnutls-v-2.la - ++++ guile-gnutls-v5.0.1/guile/src/Makefile.am 2026-02-26 09:33:43 +@@ -40,7 +40,11 @@ # Use '-module' to build a "dlopenable module", in Libtool terms. # Use '-undefined' to placate Libtool on Windows; see # . ++if BUILD_SHARED guile_gnutls_v_2_la_LDFLAGS = -module -no-undefined +else -+noinst_LTLIBRARIES = guile-gnutls-v-2.la +guile_gnutls_v_2_la_LDFLAGS = -all-static -no-undefined +endif diff --git a/steps-guix/manifest b/steps-guix/manifest index 65a40058..8b2ac05b 100644 --- a/steps-guix/manifest +++ b/steps-guix/manifest @@ -21,7 +21,10 @@ build: cmake-4.2.3 build: libgit2-1.9.2 build: nettle-3.10.2 build: libtasn1-v4.21.0 -build: gnutls-3.8.0 +build: gnutls-3.8.12 build: guile-gnutls-v5.0.1 +# build: unzip-6.0 +# build: sqlite-3510200 +# build: guile-sqlite3-0.1.3 improve: after diff --git a/steps/improve/make_bootable.sh b/steps/improve/make_bootable.sh index 22195373..9bfa1037 100644 --- a/steps/improve/make_bootable.sh +++ b/steps/improve/make_bootable.sh @@ -38,7 +38,28 @@ cd /steps . ./bootstrap.cfg . ./env . ./helpers.sh -trap 'env PATH=${PREFIX}/bin PS1="[TRAP] \w # " bash -i' ERR + +shutdown_system() { + status="${1:-0}" + echo "init: shutting down (status=${status})" >&2 + # ignore errors due to fstab or swapfile not existing + swapoff -a &> /dev/null || true + sync + # sysrq to avoid device busy; then mount to wait for it to finish + echo u > /proc/sysrq-trigger + mount -o remount,ro / || true + echo o > /proc/sysrq-trigger # power off + while true; do sleep 1; done +} + +on_error() { + status=$? + trap - ERR + echo "init: error detected, aborting bootstrap path." >&2 + shutdown_system "${status}" +} + +trap 'on_error' ERR setup_kernel_devices() { mount | grep ' on /dev ' &> /dev/null || (mkdir -p /dev; mount -t devtmpfs devtmpfs /dev) @@ -77,7 +98,7 @@ verify_kernel_devices() { setup_kernel_devices verify_kernel_devices || { echo "Kernel device setup verification failed." >&2 - exit 1 + shutdown_system 1 } if test -f /swapfile; then @@ -97,7 +118,7 @@ run_steps_guix_if_requested() { fi if [ ! -f /steps-guix/manifest ]; then echo "BUILD_GUIX_ALSO is True but /steps-guix/manifest is missing." >&2 - exit 1 + return 1 fi sed -i '/^BUILD_GUIX_ALSO=/d' /steps/bootstrap.cfg @@ -105,10 +126,12 @@ run_steps_guix_if_requested() { /script-generator /steps-guix/manifest /steps bash /steps-guix/0.sh - return 0 + return $? } -run_steps_guix_if_requested || true +if [ "${BUILD_GUIX_ALSO}" = True ]; then + run_steps_guix_if_requested || shutdown_system $? +fi EOF fi @@ -123,14 +146,7 @@ else env - PATH=${PREFIX}/bin PS1="\w # " setsid openvt -fec1 -- bash -i fi -# ignore errors due to fstab or swapfile not existing -swapoff -a &> /dev/null || true -sync -# sysrq to avoid device busy; then mount to wait for it to finish -echo u > /proc/sysrq-trigger -mount -o remount,ro / -echo o > /proc/sysrq-trigger # power off -while true; do sleep 1; done +shutdown_system 0 EOF chmod +x /init