From c86feaa6b073f2714e04fb464024962f94315411 Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Fri, 23 Jan 2026 19:08:36 +0100 Subject: [PATCH] fix(hexojs): Fix container startup and Hexo server execution - Add start-hexo.sh script as container init command - Set PATH properly for hexo CLI in lxc_exec() - Container now starts Hexo server automatically on boot - Falls back to tail -f /dev/null if no site exists Co-Authored-By: Claude Opus 4.5 --- .../secubox-app-hexojs/files/usr/sbin/hexoctl | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/package/secubox/secubox-app-hexojs/files/usr/sbin/hexoctl b/package/secubox/secubox-app-hexojs/files/usr/sbin/hexoctl index 08dcf910..c26f03f3 100644 --- a/package/secubox/secubox-app-hexojs/files/usr/sbin/hexoctl +++ b/package/secubox/secubox-app-hexojs/files/usr/sbin/hexoctl @@ -276,7 +276,24 @@ lxc_run() { # Regenerate config in case settings changed lxc_create_config - log_info "Starting Hexo container..." + # Ensure start script exists in container + local start_script="$LXC_ROOTFS/opt/start-hexo.sh" + if [ ! -f "$start_script" ]; then + cat > "$start_script" << 'STARTEOF' +#!/bin/sh +export PATH=/usr/local/bin:/usr/bin:/bin:$PATH +export HOME=/root +export NODE_ENV=production +HEXO_PORT="${HEXO_PORT:-4000}" +SITE_DIR="/opt/hexojs/site" +cd "$SITE_DIR" 2>/dev/null || exec tail -f /dev/null +[ -d "$SITE_DIR/public" ] || hexo generate +exec hexo server -p "$HEXO_PORT" +STARTEOF + chmod +x "$start_script" + fi + + log_info "Starting Hexo container on port $http_port..." exec lxc-start -n "$LXC_NAME" -F -f "$LXC_CONFIG" } @@ -285,7 +302,7 @@ lxc_exec() { log_error "Container not running. Start with: /etc/init.d/hexojs start" return 1 fi - lxc-attach -n "$LXC_NAME" -- "$@" + lxc-attach -n "$LXC_NAME" -- env PATH=/usr/local/bin:/usr/bin:/bin "$@" } # Commands