fix(lyrion): Fix incomplete installation detection and add destroy command

- lxc_create_rootfs now checks for Lyrion installation (slimserver.pl)
  instead of just Alpine (alpine-release) to detect complete installs
- Auto-cleanup incomplete installations where Alpine downloaded but
  Lyrion failed to install (e.g., network issues during chroot)
- Add verification after installation to confirm Lyrion was installed
- Add 'destroy' command to manually clean up failed installations
- Bump version to 2.0.1

This fixes the issue where 'lyrionctl install' would report success
when Alpine was downloaded but the chroot setup script failed silently.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-01-22 05:29:20 +01:00
parent 2dc9f6831b
commit 7a6d7bc71a
2 changed files with 51 additions and 4 deletions

View File

@ -1,8 +1,8 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=secubox-app-lyrion PKG_NAME:=secubox-app-lyrion
PKG_RELEASE:=2 PKG_RELEASE:=1
PKG_VERSION:=2.0.0 PKG_VERSION:=2.0.1
PKG_ARCH:=all PKG_ARCH:=all
PKG_MAINTAINER:=CyberMind Studio <contact@cybermind.fr> PKG_MAINTAINER:=CyberMind Studio <contact@cybermind.fr>
PKG_LICENSE:=Apache-2.0 PKG_LICENSE:=Apache-2.0

View File

@ -21,6 +21,7 @@ Commands:
install Install prerequisites, prep folders, pull/create container install Install prerequisites, prep folders, pull/create container
check Run prerequisite checks (storage, runtime) check Run prerequisite checks (storage, runtime)
update Update container image and restart service update Update container image and restart service
destroy Remove container and rootfs (for reinstall)
status Show container status status Show container status
logs Show container logs (use -f to follow) logs Show container logs (use -f to follow)
shell Open shell in container shell Open shell in container
@ -206,11 +207,19 @@ lxc_check_prereqs() {
lxc_create_rootfs() { lxc_create_rootfs() {
load_config load_config
if [ -d "$LXC_ROOTFS" ] && [ -f "$LXC_ROOTFS/etc/alpine-release" ]; then # Check for COMPLETE installation (Lyrion installed, not just Alpine)
log_info "LXC rootfs already exists" if [ -d "$LXC_ROOTFS" ] && [ -f "$LXC_ROOTFS/opt/lyrion/slimserver.pl" ] && [ -f "$LXC_CONFIG" ]; then
log_info "LXC rootfs already exists with Lyrion installed"
return 0 return 0
fi fi
# Check for incomplete installation (Alpine exists but Lyrion not installed)
if [ -d "$LXC_ROOTFS" ] && [ -f "$LXC_ROOTFS/etc/alpine-release" ] && [ ! -f "$LXC_ROOTFS/opt/lyrion/slimserver.pl" ]; then
log_warn "Incomplete installation detected (Alpine downloaded but Lyrion not installed)"
log_info "Cleaning up incomplete rootfs..."
rm -rf "$LXC_PATH/$LXC_NAME"
fi
log_info "Creating LXC rootfs for Lyrion..." log_info "Creating LXC rootfs for Lyrion..."
ensure_dir "$LXC_PATH/$LXC_NAME" ensure_dir "$LXC_PATH/$LXC_NAME"
@ -222,6 +231,13 @@ lxc_create_rootfs() {
lxc_create_alpine_rootfs || return 1 lxc_create_alpine_rootfs || return 1
fi fi
# Verify Lyrion was actually installed
if [ ! -f "$LXC_ROOTFS/opt/lyrion/slimserver.pl" ]; then
log_error "Lyrion installation failed - slimserver.pl not found"
log_error "Check network connectivity and try again"
return 1
fi
# Create LXC config # Create LXC config
lxc_create_config || return 1 lxc_create_config || return 1
@ -555,6 +571,36 @@ cmd_update() {
fi fi
} }
cmd_destroy() {
require_root
load_config
local rt=$(detect_runtime 2>/dev/null)
case "$rt" in
docker)
docker_stop
log_info "Docker container stopped. Image kept for reinstall."
log_info "To remove image: docker rmi $image"
;;
lxc)
lxc_destroy
;;
*)
# No runtime detected, but try to clean up LXC anyway
if [ -d "$LXC_PATH/$LXC_NAME" ]; then
log_info "Removing LXC rootfs..."
rm -rf "$LXC_PATH/$LXC_NAME"
log_info "LXC container destroyed"
else
log_info "No container found to destroy"
fi
;;
esac
log_info "To reinstall: lyrionctl install"
}
cmd_status() { cmd_status() {
local rt=$(detect_runtime 2>/dev/null) local rt=$(detect_runtime 2>/dev/null)
case "$rt" in case "$rt" in
@ -634,6 +680,7 @@ case "${1:-}" in
install) shift; cmd_install "$@" ;; install) shift; cmd_install "$@" ;;
check) shift; cmd_check "$@" ;; check) shift; cmd_check "$@" ;;
update) shift; cmd_update "$@" ;; update) shift; cmd_update "$@" ;;
destroy) shift; cmd_destroy "$@" ;;
status) shift; cmd_status "$@" ;; status) shift; cmd_status "$@" ;;
logs) shift; cmd_logs "$@" ;; logs) shift; cmd_logs "$@" ;;
shell) shift; cmd_shell "$@" ;; shell) shift; cmd_shell "$@" ;;