Compare commits

..

No commits in common. "99af60bc16a2be9a26a196008398762071d7ad5d" and "b945c831a05a5a4f2aef45c4b3417dbdfb22d75f" have entirely different histories.

View File

@ -104,7 +104,6 @@ while [[ $# -gt 0 ]]; do
--out) OUT_DIR="$2"; shift 2 ;; --out) OUT_DIR="$2"; shift 2 ;;
--size) IMG_SIZE="$2"; shift 2 ;; --size) IMG_SIZE="$2"; shift 2 ;;
--local-cache) USE_LOCAL_CACHE=1; shift ;; --local-cache) USE_LOCAL_CACHE=1; shift ;;
--kiosk) INCLUDE_KIOSK=1; shift ;;
--no-kiosk) INCLUDE_KIOSK=0; shift ;; --no-kiosk) INCLUDE_KIOSK=0; shift ;;
--no-persistence) INCLUDE_PERSISTENCE=0; shift ;; --no-persistence) INCLUDE_PERSISTENCE=0; shift ;;
--no-compress) NO_COMPRESS=1; shift ;; --no-compress) NO_COMPRESS=1; shift ;;
@ -3216,16 +3215,12 @@ fi
# Verify nginx config is valid # Verify nginx config is valid
if [[ -x "${ROOTFS}/usr/sbin/nginx" ]]; then if [[ -x "${ROOTFS}/usr/sbin/nginx" ]]; then
if ! chroot "${ROOTFS}" nginx -t 2>&1 | grep -q "syntax is ok"; then if ! chroot "${ROOTFS}" nginx -t 2>&1 | grep -q "syntax is ok"; then
warn "nginx config still invalid after final cleanup (regenerated at first boot)" warn "nginx config still invalid after final cleanup"
# Show the error and try to fix. `|| true`: nginx -t returns non-zero here # Show the error and try to fix
# (config IS invalid — that's why we're in this branch), so without it the nginx_error=$(chroot "${ROOTFS}" nginx -t 2>&1 | head -5)
# command substitution trips set -e/pipefail and aborts the whole build
# right after this warn. The image's nginx config is rebuilt at first boot
# by secubox-net-detect, so a build-time-invalid config is non-fatal.
nginx_error=$(chroot "${ROOTFS}" nginx -t 2>&1 | head -5 || true)
echo "$nginx_error" echo "$nginx_error"
# Extract missing file from error message and create empty config # Extract missing file from error message and create empty config
missing_file=$(echo "$nginx_error" | grep -oP '"/etc/nginx/secubox\.d/\K[^"]+' || true) missing_file=$(echo "$nginx_error" | grep -oP '"/etc/nginx/secubox\.d/\K[^"]+')
if [[ -n "$missing_file" ]]; then if [[ -n "$missing_file" ]]; then
log "Creating missing config: $missing_file" log "Creating missing config: $missing_file"
touch "${ROOTFS}/etc/nginx/secubox.d/${missing_file}" touch "${ROOTFS}/etc/nginx/secubox.d/${missing_file}"