fix(localai): Check Docker daemon is running before extracting rootfs
- Add runtime_is_working() to verify daemon connectivity - Falls back to standalone binary with helpful message if daemon not running - Provides hint: /etc/init.d/dockerd start Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
23d511fcae
commit
ec1f722687
@ -65,7 +65,45 @@
|
|||||||
"WebFetch(domain:docs.cybermind.fr)",
|
"WebFetch(domain:docs.cybermind.fr)",
|
||||||
"WebFetch(domain:lyrion.org)",
|
"WebFetch(domain:lyrion.org)",
|
||||||
"Bash(git pull:*)",
|
"Bash(git pull:*)",
|
||||||
"Bash(git stash:*)"
|
"Bash(git stash:*)",
|
||||||
|
"Bash(./secubox-tools/localbuild.sh:*)",
|
||||||
|
"Bash(./scripts/sync-to-feed.sh:*)",
|
||||||
|
"Bash(sh:*)",
|
||||||
|
"Bash(dash:*)",
|
||||||
|
"Bash(scp:*)",
|
||||||
|
"Bash(/home/reepost/CyberMindStudio/_files/secubox-openwrt/secubox-tools/local-build.sh:*)",
|
||||||
|
"Bash(ping:*)",
|
||||||
|
"WebFetch(domain:docs.mitmproxy.org)",
|
||||||
|
"WebSearch",
|
||||||
|
"WebFetch(domain:forum.openwrt.org)",
|
||||||
|
"WebFetch(domain:nicolargo.github.io)",
|
||||||
|
"Bash(ssh-keygen:*)",
|
||||||
|
"Bash(scripts/build-packages.sh:*)",
|
||||||
|
"Bash(readlink:*)",
|
||||||
|
"Bash(ROUTER_IP=\"192.168.8.191\":*)",
|
||||||
|
"Bash(PKG_PATH=\"/home/reepost/CyberMindStudio/_files/secubox-openwrt/secubox-tools/build/aarch64_cortex-a72/secubox-app-webapp_1.1.0-r1_all.ipk\")",
|
||||||
|
"Bash(__NEW_LINE_cfb353d51df65726__ echo \"Deploying to router $ROUTER_IP...\")",
|
||||||
|
"Bash(__NEW_LINE_cfb353d51df65726__ echo \"Installing package on router...\")",
|
||||||
|
"Bash(ROUTER_IP=\"192.168.8.1\")",
|
||||||
|
"Bash(__NEW_LINE_63a99eb14feaadfb__ echo \"Deploying to router $ROUTER_IP...\")",
|
||||||
|
"Bash(__NEW_LINE_63a99eb14feaadfb__ echo \"Installing package on router...\")",
|
||||||
|
"Bash(__NEW_LINE_dd8ac110f380441b__ echo \"Deploying to router $ROUTER_IP...\")",
|
||||||
|
"Bash(__NEW_LINE_dd8ac110f380441b__ echo \"Installing package on router...\")",
|
||||||
|
"Bash(ROUTER_IP=\"192.168.255.1\":*)",
|
||||||
|
"Bash(__NEW_LINE_23d0cf42d6f3e749__ echo \"Deploying to router $ROUTER_IP...\")",
|
||||||
|
"Bash(__NEW_LINE_23d0cf42d6f3e749__ echo \"Installing package on router...\")",
|
||||||
|
"Bash(PKG_PATH=\"/home/reepost/CyberMindStudio/_files/secubox-openwrt/secubox-tools/build/aarch64_cortex-a72/secubox-app-webapp_1.2.0-r1_all.ipk\":*)",
|
||||||
|
"Bash(__NEW_LINE_149ef654235bfc1e__ echo \"Deploying v1.2.0 to router $ROUTER_IP...\")",
|
||||||
|
"Bash(__NEW_LINE_149ef654235bfc1e__ echo \"Installing package on router...\")",
|
||||||
|
"Bash(PKG_PATH=\"/home/reepost/CyberMindStudio/_files/secubox-openwrt/secubox-tools/build/aarch64_cortex-a72/secubox-app-webapp_1.3.0-r1_all.ipk\")",
|
||||||
|
"Bash(__NEW_LINE_00785cf715958748__ echo \"Deploying optimized v1.3.0 to router $ROUTER_IP...\")",
|
||||||
|
"Bash(__NEW_LINE_00785cf715958748__ echo \"Installing package on router...\")",
|
||||||
|
"Bash(wc:*)",
|
||||||
|
"WebFetch(domain:api.github.com)",
|
||||||
|
"Bash(./build.sh:*)",
|
||||||
|
"Bash(cd /home/reepost/CyberMindStudio/_files/secubox-openwrt/secubox-tools/sdk ./scripts/feeds update secubox)",
|
||||||
|
"Bash(./staging_dir/host/bin/ipkg-build:*)",
|
||||||
|
"Bash(./scripts/ipkg-build:*)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=secubox-app-localai
|
PKG_NAME:=secubox-app-localai
|
||||||
PKG_RELEASE:=8
|
PKG_RELEASE:=9
|
||||||
PKG_VERSION:=0.1.0
|
PKG_VERSION:=0.1.0
|
||||||
PKG_ARCH:=all
|
PKG_ARCH:=all
|
||||||
PKG_MAINTAINER:=CyberMind Studio <contact@cybermind.fr>
|
PKG_MAINTAINER:=CyberMind Studio <contact@cybermind.fr>
|
||||||
|
|||||||
@ -185,15 +185,19 @@ lxc_install() {
|
|||||||
local rootfs="$lxc_path/$CONTAINER_NAME/rootfs"
|
local rootfs="$lxc_path/$CONTAINER_NAME/rootfs"
|
||||||
local config="$lxc_path/$CONTAINER_NAME/config"
|
local config="$lxc_path/$CONTAINER_NAME/config"
|
||||||
|
|
||||||
# Check if we should extract from Docker image (preferred - includes all backends)
|
# Check if we can extract from Docker image (preferred - includes all backends)
|
||||||
local use_docker_extract=0
|
local use_docker_extract=0
|
||||||
if command -v podman >/dev/null 2>&1 || command -v docker >/dev/null 2>&1; then
|
if command -v podman >/dev/null 2>&1 && runtime_is_working podman; then
|
||||||
|
use_docker_extract=1
|
||||||
|
elif command -v docker >/dev/null 2>&1 && runtime_is_working docker; then
|
||||||
use_docker_extract=1
|
use_docker_extract=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$use_docker_extract" = "1" ]; then
|
if [ "$use_docker_extract" = "1" ]; then
|
||||||
lxc_install_from_docker "$rootfs" || return 1
|
lxc_install_from_docker "$rootfs" || return 1
|
||||||
else
|
else
|
||||||
|
log_warn "No working Docker/Podman daemon - using standalone binary"
|
||||||
|
log_warn "For full backend support, start Docker: /etc/init.d/dockerd start"
|
||||||
lxc_install_standalone "$rootfs" || return 1
|
lxc_install_standalone "$rootfs" || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -205,18 +209,37 @@ lxc_install() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check if container runtime daemon is actually working
|
||||||
|
runtime_is_working() {
|
||||||
|
local rt="$1"
|
||||||
|
case "$rt" in
|
||||||
|
podman)
|
||||||
|
# Podman is daemonless, just check command works
|
||||||
|
podman info >/dev/null 2>&1
|
||||||
|
;;
|
||||||
|
docker)
|
||||||
|
# Docker needs daemon running
|
||||||
|
docker info >/dev/null 2>&1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
# Extract rootfs from Docker image (includes all backends)
|
# Extract rootfs from Docker image (includes all backends)
|
||||||
lxc_install_from_docker() {
|
lxc_install_from_docker() {
|
||||||
local rootfs="$1"
|
local rootfs="$1"
|
||||||
local rt=""
|
local rt=""
|
||||||
|
|
||||||
# Detect available runtime for extraction
|
# Detect available AND WORKING runtime for extraction
|
||||||
if command -v podman >/dev/null 2>&1; then
|
if command -v podman >/dev/null 2>&1 && runtime_is_working podman; then
|
||||||
rt="podman"
|
rt="podman"
|
||||||
elif command -v docker >/dev/null 2>&1; then
|
elif command -v docker >/dev/null 2>&1 && runtime_is_working docker; then
|
||||||
rt="docker"
|
rt="docker"
|
||||||
else
|
else
|
||||||
log_error "Need podman or docker to extract image"
|
log_error "Need working podman or docker to extract image"
|
||||||
|
log_error "Docker installed but daemon not running? Start with: /etc/init.d/dockerd start"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user