fix(bonus): Fix secubox-app-bonus build and opkg feed installation

- Fix recursive inclusion bug where secubox-app-bonus was including itself
  causing 1GB package size (now 7.5MB with 73 packages)
- Fix Packages index generation to strip Source/SourceName/SourceDateEpoch/URL
  fields that caused opkg parsing issues
- Add rebuild_bonus_package() to local-build.sh for proper feed embedding
- Update secubox-feed install command to handle local dependencies from files
  (workaround for opkg signature bug with file:// URLs)
- Clean up libc dependency stripping in Packages generation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-01-30 06:39:31 +01:00
parent dd63c9cfa9
commit b7b51a6749
78 changed files with 284 additions and 437 deletions

View File

@ -208,21 +208,38 @@ package_info() {
fi
}
# Install package with force-depends
# Install package from local feed (handles dependencies)
install_package() {
local pkg="$1"
local ipk_file="$FEED_DIR/${pkg}_"*.ipk
local ipk_pattern="$FEED_DIR/${pkg}_"*.ipk
# Find the IPK file
local found=$(ls $ipk_file 2>/dev/null | head -1)
local found=$(ls $ipk_pattern 2>/dev/null | head -1)
if [ -n "$found" ]; then
log "Installing $pkg..."
opkg install --force-depends "$found"
else
if [ -z "$found" ]; then
error "Package $pkg not found in local feed"
return 1
fi
log "Installing $pkg..."
# Get dependencies from the package
local deps=$(tar -xOzf "$found" control.tar.gz 2>/dev/null | tar -xOzf - ./control 2>/dev/null | grep "^Depends:" | sed 's/^Depends: //')
# Install local dependencies first
if [ -n "$deps" ]; then
for dep in $(echo "$deps" | tr ',' '\n' | sed 's/^ *//; s/ *$//; s/ (.*)//' | sort -u); do
[ -z "$dep" ] && continue
local dep_ipk=$(ls "$FEED_DIR/${dep}_"*.ipk 2>/dev/null | head -1)
if [ -n "$dep_ipk" ]; then
verbose "Installing dependency: $dep"
opkg install "$dep_ipk" 2>/dev/null || true
fi
done
fi
# Install the main package
opkg install "$found"
}
# Clean old versions

View File

@ -1,12 +1,12 @@
{
"feed_url": "/secubox-feed",
"generated": "2026-01-29T18:33:44+01:00",
"generated": "2026-01-30T06:10:43+01:00",
"packages": [
{
"name": "luci-app-auth-guardian",
"version": "0.4.0-r3",
"filename": "luci-app-auth-guardian_0.4.0-r3_all.ipk",
"size": 12083,
"size": 12086,
"category": "security",
"icon": "key",
"description": "Authentication management",
@ -18,7 +18,7 @@
"name": "luci-app-bandwidth-manager",
"version": "0.5.0-r2",
"filename": "luci-app-bandwidth-manager_0.5.0-r2_all.ipk",
"size": 66972,
"size": 66974,
"category": "network",
"icon": "activity",
"description": "Bandwidth monitoring and control",
@ -30,7 +30,7 @@
"name": "luci-app-cdn-cache",
"version": "0.5.0-r3",
"filename": "luci-app-cdn-cache_0.5.0-r3_all.ipk",
"size": 20434,
"size": 20436,
"category": "network",
"icon": "globe",
"description": "CDN caching",
@ -42,7 +42,7 @@
"name": "luci-app-client-guardian",
"version": "0.4.0-r7",
"filename": "luci-app-client-guardian_0.4.0-r7_all.ipk",
"size": 57041,
"size": 57047,
"category": "network",
"icon": "users",
"description": "Client management and monitoring",
@ -54,7 +54,7 @@
"name": "luci-app-crowdsec-dashboard",
"version": "0.7.0-r29",
"filename": "luci-app-crowdsec-dashboard_0.7.0-r29_all.ipk",
"size": 53278,
"size": 53280,
"category": "security",
"icon": "shield",
"description": "CrowdSec security monitoring",
@ -78,7 +78,7 @@
"name": "luci-app-exposure",
"version": "1.0.0-r3",
"filename": "luci-app-exposure_1.0.0-r3_all.ipk",
"size": 20532,
"size": 20534,
"category": "utility",
"icon": "package",
"description": "SecuBox package",
@ -90,7 +90,7 @@
"name": "luci-app-gitea",
"version": "1.0.0-r2",
"filename": "luci-app-gitea_1.0.0-r2_all.ipk",
"size": 15584,
"size": 15585,
"category": "utility",
"icon": "package",
"description": "SecuBox package",
@ -102,7 +102,7 @@
"name": "luci-app-glances",
"version": "1.0.0-r2",
"filename": "luci-app-glances_1.0.0-r2_all.ipk",
"size": 6964,
"size": 6967,
"category": "utility",
"icon": "package",
"description": "SecuBox package",
@ -114,7 +114,7 @@
"name": "luci-app-haproxy",
"version": "1.0.0-r8",
"filename": "luci-app-haproxy_1.0.0-r8_all.ipk",
"size": 33971,
"size": 33968,
"category": "utility",
"icon": "package",
"description": "SecuBox package",
@ -138,7 +138,7 @@
"name": "luci-app-ksm-manager",
"version": "0.4.0-r2",
"filename": "luci-app-ksm-manager_0.4.0-r2_all.ipk",
"size": 18721,
"size": 18725,
"category": "system",
"icon": "cpu",
"description": "Kernel memory management",
@ -150,7 +150,7 @@
"name": "luci-app-localai",
"version": "0.1.0-r15",
"filename": "luci-app-localai_0.1.0-r15_all.ipk",
"size": 14361,
"size": 14360,
"category": "utility",
"icon": "package",
"description": "SecuBox package",
@ -174,7 +174,7 @@
"name": "luci-app-magicmirror2",
"version": "0.4.0-r6",
"filename": "luci-app-magicmirror2_0.4.0-r6_all.ipk",
"size": 12277,
"size": 12274,
"category": "iot",
"icon": "monitor",
"description": "Smart mirror display",
@ -186,7 +186,7 @@
"name": "luci-app-mailinabox",
"version": "1.0.0-r1",
"filename": "luci-app-mailinabox_1.0.0-r1_all.ipk",
"size": 5479,
"size": 5482,
"category": "utility",
"icon": "package",
"description": "SecuBox package",
@ -198,7 +198,7 @@
"name": "luci-app-media-flow",
"version": "0.6.4-r1",
"filename": "luci-app-media-flow_0.6.4-r1_all.ipk",
"size": 19125,
"size": 19118,
"category": "media",
"icon": "film",
"description": "Media streaming",
@ -210,7 +210,7 @@
"name": "luci-app-metablogizer",
"version": "1.0.0-r3",
"filename": "luci-app-metablogizer_1.0.0-r3_all.ipk",
"size": 21652,
"size": 21650,
"category": "utility",
"icon": "package",
"description": "SecuBox package",
@ -222,7 +222,7 @@
"name": "luci-app-metabolizer",
"version": "1.0.0-r2",
"filename": "luci-app-metabolizer_1.0.0-r2_all.ipk",
"size": 4756,
"size": 4758,
"category": "utility",
"icon": "package",
"description": "SecuBox package",
@ -234,7 +234,7 @@
"name": "luci-app-mitmproxy",
"version": "0.4.0-r6",
"filename": "luci-app-mitmproxy_0.4.0-r6_all.ipk",
"size": 18934,
"size": 18933,
"category": "security",
"icon": "lock",
"description": "HTTPS proxy and traffic inspection",
@ -246,7 +246,7 @@
"name": "luci-app-mmpm",
"version": "0.2.0-r3",
"filename": "luci-app-mmpm_0.2.0-r3_all.ipk",
"size": 7902,
"size": 7904,
"category": "utility",
"icon": "package",
"description": "SecuBox package",
@ -258,7 +258,7 @@
"name": "luci-app-mqtt-bridge",
"version": "0.4.0-r4",
"filename": "luci-app-mqtt-bridge_0.4.0-r4_all.ipk",
"size": 22781,
"size": 22779,
"category": "iot",
"icon": "message-square",
"description": "MQTT bridge",
@ -270,7 +270,7 @@
"name": "luci-app-ndpid",
"version": "1.1.2-r2",
"filename": "luci-app-ndpid_1.1.2-r2_all.ipk",
"size": 22454,
"size": 22453,
"category": "security",
"icon": "eye",
"description": "Deep packet inspection",
@ -282,7 +282,7 @@
"name": "luci-app-netdata-dashboard",
"version": "0.5.0-r2",
"filename": "luci-app-netdata-dashboard_0.5.0-r2_all.ipk",
"size": 22399,
"size": 22398,
"category": "monitoring",
"icon": "bar-chart-2",
"description": "System monitoring dashboard",
@ -294,7 +294,7 @@
"name": "luci-app-network-modes",
"version": "0.5.0-r3",
"filename": "luci-app-network-modes_0.5.0-r3_all.ipk",
"size": 55612,
"size": 55611,
"category": "network",
"icon": "wifi",
"description": "Network configuration",
@ -306,7 +306,7 @@
"name": "luci-app-network-tweaks",
"version": "1.0.0-r7",
"filename": "luci-app-network-tweaks_1.0.0-r7_all.ipk",
"size": 15465,
"size": 15464,
"category": "network",
"icon": "wifi",
"description": "Network configuration",
@ -318,7 +318,7 @@
"name": "luci-app-nextcloud",
"version": "1.0.0-r1",
"filename": "luci-app-nextcloud_1.0.0-r1_all.ipk",
"size": 6483,
"size": 6485,
"category": "utility",
"icon": "package",
"description": "SecuBox package",
@ -330,7 +330,7 @@
"name": "luci-app-ollama",
"version": "0.1.0-r1",
"filename": "luci-app-ollama_0.1.0-r1_all.ipk",
"size": 11996,
"size": 11994,
"category": "utility",
"icon": "package",
"description": "SecuBox package",
@ -342,7 +342,7 @@
"name": "luci-app-picobrew",
"version": "1.0.0-r1",
"filename": "luci-app-picobrew_1.0.0-r1_all.ipk",
"size": 9980,
"size": 9977,
"category": "utility",
"icon": "package",
"description": "SecuBox package",
@ -354,7 +354,7 @@
"name": "luci-app-secubox",
"version": "0.7.1-r4",
"filename": "luci-app-secubox_0.7.1-r4_all.ipk",
"size": 54915,
"size": 54916,
"category": "system",
"icon": "box",
"description": "SecuBox system component",
@ -364,9 +364,9 @@
,
{
"name": "luci-app-secubox-admin",
"version": "1.0.0-r18",
"filename": "luci-app-secubox-admin_1.0.0-r18_all.ipk",
"size": 57118,
"version": "1.0.0-r19",
"filename": "luci-app-secubox-admin_1.0.0-r19_all.ipk",
"size": 57096,
"category": "system",
"icon": "box",
"description": "SecuBox system component",
@ -378,7 +378,7 @@
"name": "luci-app-secubox-crowdsec",
"version": "1.0.0-r3",
"filename": "luci-app-secubox-crowdsec_1.0.0-r3_all.ipk",
"size": 13924,
"size": 13920,
"category": "system",
"icon": "box",
"description": "SecuBox system component",
@ -390,7 +390,7 @@
"name": "luci-app-secubox-netdiag",
"version": "1.0.0-r1",
"filename": "luci-app-secubox-netdiag_1.0.0-r1_all.ipk",
"size": 11997,
"size": 11999,
"category": "system",
"icon": "box",
"description": "SecuBox system component",
@ -402,7 +402,7 @@
"name": "luci-app-secubox-netifyd",
"version": "1.2.1-r1",
"filename": "luci-app-secubox-netifyd_1.2.1-r1_all.ipk",
"size": 39500,
"size": 39499,
"category": "system",
"icon": "box",
"description": "SecuBox system component",
@ -414,7 +414,7 @@
"name": "luci-app-secubox-portal",
"version": "0.7.0-r2",
"filename": "luci-app-secubox-portal_0.7.0-r2_all.ipk",
"size": 32228,
"size": 32229,
"category": "system",
"icon": "box",
"description": "SecuBox system component",
@ -426,7 +426,7 @@
"name": "luci-app-secubox-security-threats",
"version": "1.0.0-r4",
"filename": "luci-app-secubox-security-threats_1.0.0-r4_all.ipk",
"size": 13901,
"size": 13904,
"category": "system",
"icon": "box",
"description": "SecuBox system component",
@ -438,7 +438,7 @@
"name": "luci-app-service-registry",
"version": "1.0.0-r1",
"filename": "luci-app-service-registry_1.0.0-r1_all.ipk",
"size": 33350,
"size": 33352,
"category": "utility",
"icon": "package",
"description": "SecuBox package",
@ -486,7 +486,7 @@
"name": "luci-app-traffic-shaper",
"version": "0.4.0-r2",
"filename": "luci-app-traffic-shaper_0.4.0-r2_all.ipk",
"size": 15635,
"size": 15637,
"category": "network",
"icon": "filter",
"description": "Traffic shaping and QoS",
@ -498,7 +498,7 @@
"name": "luci-app-vhost-manager",
"version": "0.5.0-r5",
"filename": "luci-app-vhost-manager_0.5.0-r5_all.ipk",
"size": 29230,
"size": 29226,
"category": "network",
"icon": "server",
"description": "Virtual host management",
@ -510,7 +510,7 @@
"name": "luci-app-wireguard-dashboard",
"version": "0.7.0-r5",
"filename": "luci-app-wireguard-dashboard_0.7.0-r5_all.ipk",
"size": 45370,
"size": 45369,
"category": "vpn",
"icon": "shield",
"description": "WireGuard VPN dashboard",
@ -522,7 +522,7 @@
"name": "luci-app-zigbee2mqtt",
"version": "1.0.0-r2",
"filename": "luci-app-zigbee2mqtt_1.0.0-r2_all.ipk",
"size": 7096,
"size": 7094,
"category": "iot",
"icon": "radio",
"description": "Zigbee device management",
@ -534,7 +534,7 @@
"name": "luci-theme-secubox",
"version": "0.4.7-r1",
"filename": "luci-theme-secubox_0.4.7-r1_all.ipk",
"size": 111798,
"size": 111799,
"category": "theme",
"icon": "palette",
"description": "LuCI theme",
@ -546,7 +546,7 @@
"name": "secubox-app",
"version": "1.0.0-r2",
"filename": "secubox-app_1.0.0-r2_all.ipk",
"size": 11184,
"size": 11188,
"category": "utility",
"icon": "package",
"description": "SecuBox package",
@ -570,31 +570,19 @@
"name": "secubox-app-auth-logger",
"version": "1.2.2-r1",
"filename": "secubox-app-auth-logger_1.2.2-r1_all.ipk",
"size": 9375,
"size": 9381,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
"installed": false,
"luci_app": "luci-app-auth-logger"
}
,
{
"name": "secubox-app-bonus",
"version": "0.3.0-r2",
"filename": "secubox-app-bonus_0.3.0-r2_all.ipk",
"size": 1070255340,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
"installed": false,
"luci_app": "luci-app-bonus"
}
,
{
"name": "secubox-app-crowdsec-custom",
"version": "1.1.0-r1",
"filename": "secubox-app-crowdsec-custom_1.1.0-r1_all.ipk",
"size": 5763,
"size": 5762,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -606,7 +594,7 @@
"name": "secubox-app-cs-firewall-bouncer",
"version": "0.0.31-r4_aarch64",
"filename": "secubox-app-cs-firewall-bouncer_0.0.31-r4_aarch64_cortex-a72.ipk",
"size": 5049328,
"size": 5049327,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -618,7 +606,7 @@
"name": "secubox-app-cyberfeed",
"version": "0.2.1-r1",
"filename": "secubox-app-cyberfeed_0.2.1-r1_all.ipk",
"size": 12453,
"size": 12452,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -642,7 +630,7 @@
"name": "secubox-app-exposure",
"version": "1.0.0-r1",
"filename": "secubox-app-exposure_1.0.0-r1_all.ipk",
"size": 6834,
"size": 6833,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -654,7 +642,7 @@
"name": "secubox-app-gitea",
"version": "1.0.0-r5",
"filename": "secubox-app-gitea_1.0.0-r5_all.ipk",
"size": 9410,
"size": 9406,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -666,7 +654,7 @@
"name": "secubox-app-glances",
"version": "1.0.0-r1",
"filename": "secubox-app-glances_1.0.0-r1_all.ipk",
"size": 5539,
"size": 5534,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -678,7 +666,7 @@
"name": "secubox-app-haproxy",
"version": "1.0.0-r23",
"filename": "secubox-app-haproxy_1.0.0-r23_all.ipk",
"size": 15681,
"size": 15684,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -690,7 +678,7 @@
"name": "secubox-app-hexojs",
"version": "1.0.0-r8",
"filename": "secubox-app-hexojs_1.0.0-r8_all.ipk",
"size": 94934,
"size": 94935,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -702,7 +690,7 @@
"name": "secubox-app-localai",
"version": "2.25.0-r1",
"filename": "secubox-app-localai_2.25.0-r1_all.ipk",
"size": 5728,
"size": 5724,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -714,7 +702,7 @@
"name": "secubox-app-localai-wb",
"version": "2.25.0-r1",
"filename": "secubox-app-localai-wb_2.25.0-r1_all.ipk",
"size": 7957,
"size": 7956,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -726,7 +714,7 @@
"name": "secubox-app-lyrion",
"version": "2.0.2-r1",
"filename": "secubox-app-lyrion_2.0.2-r1_all.ipk",
"size": 7285,
"size": 7284,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -738,7 +726,7 @@
"name": "secubox-app-magicmirror2",
"version": "0.4.0-r8",
"filename": "secubox-app-magicmirror2_0.4.0-r8_all.ipk",
"size": 9249,
"size": 9252,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -762,7 +750,7 @@
"name": "secubox-app-metabolizer",
"version": "1.0.0-r3",
"filename": "secubox-app-metabolizer_1.0.0-r3_all.ipk",
"size": 13974,
"size": 13978,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -786,7 +774,7 @@
"name": "secubox-app-mmpm",
"version": "0.2.0-r5",
"filename": "secubox-app-mmpm_0.2.0-r5_all.ipk",
"size": 3981,
"size": 3980,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -798,7 +786,7 @@
"name": "secubox-app-nextcloud",
"version": "1.0.0-r2",
"filename": "secubox-app-nextcloud_1.0.0-r2_all.ipk",
"size": 2960,
"size": 2955,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -810,7 +798,7 @@
"name": "secubox-app-ollama",
"version": "0.1.0-r1",
"filename": "secubox-app-ollama_0.1.0-r1_all.ipk",
"size": 5735,
"size": 5730,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -822,7 +810,7 @@
"name": "secubox-app-picobrew",
"version": "1.0.0-r7",
"filename": "secubox-app-picobrew_1.0.0-r7_all.ipk",
"size": 5539,
"size": 5544,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -834,7 +822,7 @@
"name": "secubox-app-streamlit",
"version": "1.0.0-r5",
"filename": "secubox-app-streamlit_1.0.0-r5_all.ipk",
"size": 11732,
"size": 11723,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -846,7 +834,7 @@
"name": "secubox-app-tor",
"version": "1.0.0-r1",
"filename": "secubox-app-tor_1.0.0-r1_all.ipk",
"size": 7381,
"size": 7379,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -858,7 +846,7 @@
"name": "secubox-app-webapp",
"version": "1.5.0-r7",
"filename": "secubox-app-webapp_1.5.0-r7_all.ipk",
"size": 39171,
"size": 39169,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -870,7 +858,7 @@
"name": "secubox-app-zigbee2mqtt",
"version": "1.0.0-r3",
"filename": "secubox-app-zigbee2mqtt_1.0.0-r3_all.ipk",
"size": 3551,
"size": 3546,
"category": "secubox",
"icon": "package",
"description": "SecuBox backend service",
@ -880,9 +868,9 @@
,
{
"name": "secubox-core",
"version": "0.10.0-r8",
"filename": "secubox-core_0.10.0-r8_all.ipk",
"size": 79127,
"version": "0.10.0-r9",
"filename": "secubox-core_0.10.0-r9_all.ipk",
"size": 79091,
"category": "system",
"icon": "box",
"description": "SecuBox core components",

View File

@ -1289,9 +1289,18 @@ embed_local_feed() {
return 0
fi
# Copy all built packages
# Copy all built packages EXCEPT secubox-app-bonus itself (avoid recursive inclusion)
print_info "Copying packages to local feed..."
cp "$src_dir"/*.${pkg_ext} "$feed_dir/" 2>/dev/null || true
for pkg in "$src_dir"/*.${pkg_ext}; do
[[ -f "$pkg" ]] || continue
local basename=$(basename "$pkg")
# Skip secubox-app-bonus to avoid recursive inclusion (package including itself)
if [[ "$basename" =~ ^secubox-app-bonus_ ]]; then
print_info "Skipping $basename (avoid recursive inclusion)"
continue
fi
cp "$pkg" "$feed_dir/"
done
# Clean old versions, keep only latest
clean_old_ipk_versions "$feed_dir" "$pkg_ext"
@ -1312,31 +1321,30 @@ embed_local_feed() {
# Generate Packages index for opkg
print_info "Generating Packages index..."
(
cd "$feed_dir"
for pkg in *.${pkg_ext}; do
[[ -f "$pkg" ]] || continue
rm -f "$feed_dir/Packages" "$feed_dir/Packages.gz"
# Extract control file from package
local control=""
if [[ "$pkg_ext" == "ipk" ]]; then
control=$(tar -xzOf "$pkg" ./control.tar.gz 2>/dev/null | tar -xzOf - ./control 2>/dev/null || \
ar -p "$pkg" control.tar.gz 2>/dev/null | tar -xzOf - ./control 2>/dev/null || \
ar -p "$pkg" control.tar.zst 2>/dev/null | zstd -d 2>/dev/null | tar -xOf - ./control 2>/dev/null || true)
fi
for pkg in "$feed_dir"/*.${pkg_ext}; do
[[ -f "$pkg" ]] || continue
local pkg_basename=$(basename "$pkg")
if [[ -n "$control" ]]; then
echo "$control"
echo "Filename: $pkg"
echo "Size: $(stat -c%s "$pkg")"
echo "SHA256sum: $(sha256sum "$pkg" | cut -d' ' -f1)"
echo ""
fi
done > Packages
# Extract control file from package (IPK is tar.gz containing control.tar.gz)
local control=""
if [[ "$pkg_ext" == "ipk" ]]; then
control=$(tar -xOzf "$pkg" control.tar.gz 2>/dev/null | tar -xOzf - ./control 2>/dev/null || true)
fi
# Create compressed index
gzip -k Packages 2>/dev/null || true
)
if [[ -n "$control" ]]; then
# Strip Source/SourceName/SourceDateEpoch/URL fields (cause opkg parsing issues)
echo "$control" | grep -v "^Source:\|^SourceName:\|^SourceDateEpoch:\|^URL:" >> "$feed_dir/Packages"
echo "Filename: $pkg_basename" >> "$feed_dir/Packages"
echo "Size: $(stat -c%s "$pkg")" >> "$feed_dir/Packages"
echo "" >> "$feed_dir/Packages"
fi
done
# Create compressed index
gzip -kf "$feed_dir/Packages" 2>/dev/null || true
print_info "Generated Packages with $(grep -c '^Package:' "$feed_dir/Packages" 2>/dev/null || echo 0) packages"
# Strip libc dependency from all packages
# The SDK adds libc to all packages, but for local feeds without libc
@ -1655,6 +1663,106 @@ run_build_openwrt() {
return 0
}
# Rebuild secubox-app-bonus with populated local feed
rebuild_bonus_package() {
print_header "Rebuilding secubox-app-bonus with Local Feed"
local pkg_ext="${PKG_EXT:-ipk}"
local bonus_pkg="secubox-app-bonus"
# Sync the updated secubox-app-bonus to local-feed
print_info "Syncing secubox-app-bonus to local-feed..."
local src_dir="$SCRIPT_DIR/../package/secubox/$bonus_pkg"
local feed_dir="$SDK_DIR/../local-feed/$bonus_pkg"
if [[ ! -d "$src_dir" ]]; then
print_error "Source directory not found: $src_dir"
return 1
fi
rsync -av --delete "$src_dir/" "$feed_dir/"
print_success "Synced to local-feed"
# Update the feed and install the package
cd "$SDK_DIR"
print_info "Updating feeds..."
./scripts/feeds update secubox
./scripts/feeds install "$bonus_pkg" 2>&1 | grep -v "WARNING:" || true
# Enable and rebuild the package
echo "CONFIG_PACKAGE_${bonus_pkg}=m" >> .config
make defconfig FORCE=1 2>/dev/null
print_info "Building $bonus_pkg..."
local build_log="/tmp/build-${bonus_pkg}.log"
if timeout 600 make "package/feeds/secubox/${bonus_pkg}/compile" V=s -j1 NO_DEPS=1 FORCE=1 > "$build_log" 2>&1; then
local pkg_file=$(find bin -name "${bonus_pkg}*.${pkg_ext}" 2>/dev/null | head -1)
if [[ -n "$pkg_file" ]]; then
print_success "Built: $bonus_pkg"
echo "$pkg_file"
# Copy to build directory (but NOT into the feed - avoid recursive inclusion)
mkdir -p "$BUILD_DIR/$ARCH"
cp "$pkg_file" "$BUILD_DIR/$ARCH/"
# NOTE: We do NOT copy secubox-app-bonus into its own feed directory
# This would cause infinite size growth (package including itself)
# Regenerate Packages index (without secubox-app-bonus)
print_info "Regenerating Packages index..."
(
cd "$feed_src_dir"
rm -f Packages Packages.gz
for pkg in *.${pkg_ext}; do
[[ -f "$pkg" ]] || continue
local control=""
if [[ "$pkg_ext" == "ipk" ]]; then
control=$(tar -xzOf "$pkg" ./control.tar.gz 2>/dev/null | tar -xzOf - ./control 2>/dev/null || \
ar -p "$pkg" control.tar.gz 2>/dev/null | tar -xzOf - ./control 2>/dev/null || \
ar -p "$pkg" control.tar.zst 2>/dev/null | zstd -d 2>/dev/null | tar -xOf - ./control 2>/dev/null || true)
fi
if [[ -n "$control" ]]; then
echo "$control"
echo "Filename: $pkg"
echo "Size: $(stat -c%s "$pkg")"
echo ""
fi
done > Packages
# Strip libc dependencies
sed -i \
-e 's/^Depends: libc$/Depends:/g' \
-e 's/^Depends: libc, /Depends: /g' \
-e 's/, libc$//g' \
-e 's/, libc,/,/g' \
Packages
gzip -kf Packages 2>/dev/null || true
rm -f Packages.sig 2>/dev/null || true
)
print_success "Packages index regenerated"
else
print_warning "No .${pkg_ext} generated for $bonus_pkg"
tail -50 "$build_log"
return 1
fi
else
print_error "Build failed: $bonus_pkg"
tail -100 "$build_log"
return 1
fi
cd - > /dev/null
print_success "secubox-app-bonus rebuilt with local feed"
return 0
}
# Run build
run_build() {
local single_package="$1"
@ -1673,10 +1781,11 @@ run_build() {
build_packages "$single_package" || return 1
collect_artifacts || return 1
embed_local_feed || return 1
rebuild_bonus_package || return 1
print_header "Build Complete!"
print_success "Packages available in: $BUILD_DIR/$ARCH/"
print_info "Local feed embedded in secubox-app-bonus"
print_info "Local feed embedded in secubox-app-bonus with Packages index"
return 0
}