From db7d8fe3f957f5b007a914145d3cb32e9202fb39 Mon Sep 17 00:00:00 2001 From: Sam & Claude Date: Sun, 14 Jun 2026 22:09:54 +0200 Subject: [PATCH] fix(iso): accept corrected colibri rc source (Sam & Codex) Keep ISO staging compatible with Colibri rc.d sources that already use colibri_daemon_binary and include pid/socket chmods. This lets the source rc.d file be copied directly for live USB repair while preserving compatibility with older Colibri sources.\n\nChecks: sh -n scripts/stage-colibri-iso.sh; fake staging against old and corrected Colibri rc sources; sh -n staged rc.d scripts; git diff --check. --- scripts/stage-colibri-iso.sh | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/scripts/stage-colibri-iso.sh b/scripts/stage-colibri-iso.sh index 74b77965..11abd799 100755 --- a/scripts/stage-colibri-iso.sh +++ b/scripts/stage-colibri-iso.sh @@ -71,7 +71,7 @@ install -m 0555 "${RC_SOURCE}" "${RC_DIR}/colibri_daemon" install -m 0644 "${NEWSYSLOG_SOURCE}" "${NEWSYSLOG_DIR}/colibri.conf" if ! grep -q '^command="/usr/sbin/daemon"' "${RC_DIR}/colibri_daemon" || \ - ! grep -q -- '-o .*colibri_daemon_program' "${RC_DIR}/colibri_daemon"; then + ! grep -Eq -- '-o .*colibri_daemon_(program|binary)' "${RC_DIR}/colibri_daemon"; then echo "ERROR: staged colibri_daemon rc.d script does not supervise colibri-daemon with daemon(8)" >&2 echo " Update COLIBRI_REPO (${COLIBRI_REPO}) before building; the live USB must not block boot in rc.d." >&2 exit 66 @@ -87,7 +87,9 @@ sed -i '' 's/^procname="\/usr\/sbin\/daemon"$/procname="daemon:"/' \ # Fix ${name}_program override: rc.subr line 1120 silently replaces # command= with ${name}_program if set, so colibri_daemon_program= # overrode command="/usr/sbin/daemon" — daemon(8) was never invoked. -# Rename the variable so rc.subr leaves command= alone. +# Rename the variable so rc.subr leaves command= alone. Newer Colibri sources +# may already use colibri_daemon_binary; this replacement is intentionally +# harmless when there is no old variable left. sed -i '' 's/colibri_daemon_program/colibri_daemon_binary/g' \ "${RC_DIR}/colibri_daemon" @@ -102,16 +104,19 @@ sed -i '' 's/ -u \${colibri_daemon_user} //' \ # running 'service colibri_daemon status'. Chmod in poststart. # Use awk instead of sed append syntax: BSD sed's multi-line append form is # easy to get wrong and can corrupt the rc.d script by appending to every line. -_rc_tmp="${RC_DIR}/colibri_daemon.tmp" -awk ' - { print } - /socket ready/ { - print " chmod 644 \"${pidfile}\" 2>/dev/null || true" - print " chmod 660 \"${colibri_daemon_socket}\" 2>/dev/null || true" - } -' "${RC_DIR}/colibri_daemon" > "${_rc_tmp}" -mv "${_rc_tmp}" "${RC_DIR}/colibri_daemon" -chmod 0555 "${RC_DIR}/colibri_daemon" +# Newer Colibri sources may already carry these chmods; do not duplicate them. +if ! grep -q 'chmod 644 "${pidfile}"' "${RC_DIR}/colibri_daemon"; then + _rc_tmp="${RC_DIR}/colibri_daemon.tmp" + awk ' + { print } + /socket ready/ { + print " chmod 644 \"${pidfile}\" 2>/dev/null || true" + print " chmod 660 \"${colibri_daemon_socket}\" 2>/dev/null || true" + } + ' "${RC_DIR}/colibri_daemon" > "${_rc_tmp}" + mv "${_rc_tmp}" "${RC_DIR}/colibri_daemon" + chmod 0555 "${RC_DIR}/colibri_daemon" +fi # Add DeepSeek API key and cache warming to daemon environment. # These are injected into the rc.d prestart so the daemon picks them up -- 2.45.3