From 43568ef41bf85fafabe3baef3cad3fdac3810504 Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Wed, 31 Dec 2025 13:17:07 +0100 Subject: [PATCH] fix(secubox): make postinst script non-failing and add auto-recovery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The postinst script was failing installation (exit 1) when the appstore catalog wasn't found, which prevented package upgrades from completing. Changes: 1. Removed exit 1 - installation now continues even if file is missing 2. Added auto-recovery: tries to restore from /rom overlay if available 3. Provides clear status feedback (✓ or ✗) for appstore catalog 4. Gives helpful error message with recovery instructions 5. Always exits with 0 to allow installation to complete This fixes upgrades from 0.7.0-r2 to 0.7.0-r4 where the directory structure changed from .appstore to appstore. Version: 0.7.0-4 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- luci-app-secubox/Makefile | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/luci-app-secubox/Makefile b/luci-app-secubox/Makefile index f53ef30a..c4f0a384 100644 --- a/luci-app-secubox/Makefile +++ b/luci-app-secubox/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-secubox PKG_VERSION:=0.7.0 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_LICENSE:=Apache-2.0 PKG_MAINTAINER:=CyberMind @@ -46,14 +46,24 @@ define Package/$(PKG_NAME)/postinst # Ensures appstore catalog and permissions are correct [ -n "$${IPKG_INSTROOT}" ] || { - # Verify appstore catalog exists + # Check if appstore catalog exists if [ ! -f /usr/share/secubox/appstore/apps.json ]; then - echo "WARNING: SecuBox appstore catalog not found!" - echo "Expected: /usr/share/secubox/appstore/apps.json" - exit 1 + echo "WARNING: SecuBox appstore catalog not found at /usr/share/secubox/appstore/apps.json" + + # Try to restore from package ROM overlay + if [ -f /rom/usr/share/secubox/appstore/apps.json ]; then + echo " Restoring from package overlay..." + mkdir -p /usr/share/secubox/appstore + cp /rom/usr/share/secubox/appstore/apps.json /usr/share/secubox/appstore/apps.json + echo " ✓ Restored appstore catalog" + else + echo " ERROR: Appstore catalog not found in package!" + echo " The app store will be empty until this is fixed." + echo " Try: opkg remove luci-app-secubox && opkg install luci-app-secubox" + fi fi - # Set proper permissions + # Set proper permissions (safe even if files don't exist) chmod 755 /usr/share/secubox 2>/dev/null || true chmod 755 /usr/share/secubox/appstore 2>/dev/null || true chmod 644 /usr/share/secubox/appstore/apps.json 2>/dev/null || true @@ -63,8 +73,12 @@ define Package/$(PKG_NAME)/postinst /etc/init.d/rpcd reload 2>/dev/null || true echo "SecuBox: Installation complete" - echo " - Appstore catalog: /usr/share/secubox/appstore/apps.json" - echo " - RPCD methods available via: ubus call luci.secubox" + if [ -f /usr/share/secubox/appstore/apps.json ]; then + echo " ✓ Appstore catalog: /usr/share/secubox/appstore/apps.json" + else + echo " ✗ Appstore catalog: MISSING" + fi + echo " ✓ RPCD methods available via: ubus call luci.secubox" } exit 0 endef