From adfeed60e2a92d0a9c8da076a6c0af995bce624e Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Sun, 4 Jan 2026 14:42:34 +0100 Subject: [PATCH] docs: Add automated deployment script and documentation Add comprehensive deployment automation for SecuBox AppStore updates: - deploy-to-router.sh: Automated build and deploy script - Rebuilds packages - Copies to router - Installs with --force-reinstall - Restarts RPCD - Verifies installation - Tests RPC methods - DEPLOY_UPDATES.md: Complete deployment documentation - Quick deploy instructions - Verification steps - Troubleshooting guide - Package version tracking Usage: ./deploy-to-router.sh Or with custom router IP: ROUTER_IP=192.168.1.1 ./deploy-to-router.sh --- DEPLOY_UPDATES.md | 134 ++++++++++++++++++++++++++++++++++++++++ deploy-to-router.sh | 146 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 280 insertions(+) create mode 100644 DEPLOY_UPDATES.md create mode 100755 deploy-to-router.sh diff --git a/DEPLOY_UPDATES.md b/DEPLOY_UPDATES.md new file mode 100644 index 00000000..0a21657d --- /dev/null +++ b/DEPLOY_UPDATES.md @@ -0,0 +1,134 @@ +# Deploy SecuBox AppStore Updates + +## Quick Deploy (All Packages) + +```bash +# 1. Rebuild all affected packages +cd /home/reepost/CyberMindStudio/_files/secubox-openwrt +./secubox-tools/local-build.sh secubox-core luci-app-secubox-admin + +# 2. Copy packages to router +scp bin/packages/x86_64/secubox/secubox-core_*.ipk \ + bin/packages/x86_64/secubox/luci-app-secubox-admin_*.ipk \ + root@192.168.8.191:/tmp/ + +# 3. Install on router +ssh root@192.168.8.191 << 'ENDSSH' +# Install packages (force-reinstall to update) +opkg install --force-reinstall /tmp/secubox-core_*.ipk +opkg install --force-reinstall /tmp/luci-app-secubox-admin_*.ipk + +# Restart RPCD to reload ACLs +/etc/init.d/rpcd restart + +# Verify ACL file is in place +ls -l /usr/share/rpcd/acl.d/luci-app-secubox-admin.json + +echo "Installation complete!" +ENDSSH + +# 4. Clear browser cache and reload +# - Press Ctrl+Shift+R in browser +# - Or clear cache manually in browser settings +``` + +## Verify Installation + +On the router: + +```bash +# Check installed versions +opkg list-installed | grep secubox + +# Verify ACL file contents +cat /usr/share/rpcd/acl.d/luci-app-secubox-admin.json + +# Test RPC methods directly +ubus -S call luci.secubox get_catalog_sources +ubus -S call luci.secubox check_updates +``` + +## What Was Fixed + +### ACL Permissions Added + +**Read permissions** (5 new methods): +- `get_catalog_sources` +- `check_updates` +- `get_app_versions` +- `get_changelog` +- `get_widget_data` + +**Write permissions** (2 new methods): +- `set_catalog_source` +- `sync_catalog` + +**UCI access**: +- `secubox-appstore` config + +### Package Versions + +- `secubox-core`: 0.8.0-6 +- `luci-app-secubox-admin`: 1.0.0-4 + +### Recent Fixes + +**v1.0.0-4** (Latest): +- Fixed WidgetRenderer undefined options TypeError +- Added defensive check: `options = options || {};` + +**v1.0.0-3**: +- Added ACL permissions for new RPC methods +- Added UCI access to `secubox-appstore` config + +## Troubleshooting + +### Still Getting "Access Denied"? + +1. **Verify ACL file was installed**: + ```bash + ssh root@192.168.8.191 "cat /usr/share/rpcd/acl.d/luci-app-secubox-admin.json | grep get_catalog_sources" + ``` + Should show the method name in the file. + +2. **Check RPCD is running**: + ```bash + ssh root@192.168.8.191 "ps | grep rpcd" + ``` + +3. **Restart RPCD**: + ```bash + ssh root@192.168.8.191 "/etc/init.d/rpcd restart" + ``` + +4. **Check for ACL conflicts**: + ```bash + ssh root@192.168.8.191 "grep -r 'luci.secubox' /usr/share/rpcd/acl.d/" + ``` + +5. **Clear browser cache completely**: + - Close all browser windows + - Clear cache and cookies for router IP + - Reopen browser + +### Test Individual Methods + +```bash +# On router, test each method: +ubus -S call luci.secubox get_catalog_sources +ubus -S call luci.secubox check_updates +ubus -S call luci.secubox get_app_versions '{"app_id":"luci-app-auth-guardian"}' +ubus -S call luci.secubox get_changelog '{"app_id":"luci-app-auth-guardian"}' +ubus -S call luci.secubox get_widget_data '{"app_id":"luci-app-auth-guardian"}' +``` + +If these work via `ubus` but not in browser, it's a browser cache issue. + +## Files Changed in This Update + +1. `/usr/share/rpcd/acl.d/luci-app-secubox-admin.json` - ACL permissions +2. `/usr/libexec/rpcd/luci.secubox` - RPCD methods (already has the methods from Phase 2) +3. `/usr/sbin/secubox-catalog-sync` - New sync script +4. `/usr/sbin/secubox-appstore` - Enhanced CLI +5. `/etc/config/secubox-appstore` - New UCI config +6. All new LuCI views and widget system files diff --git a/deploy-to-router.sh b/deploy-to-router.sh new file mode 100755 index 00000000..24363809 --- /dev/null +++ b/deploy-to-router.sh @@ -0,0 +1,146 @@ +#!/bin/bash +# +# Deploy SecuBox AppStore Updates to Router +# +# This script rebuilds and deploys the updated packages to your OpenWrt router. +# + +set -e # Exit on error + +# Configuration +ROUTER_IP="${ROUTER_IP:-192.168.8.191}" +ROUTER_USER="${ROUTER_USER:-root}" +BUILD_DIR="$(cd "$(dirname "$0")" && pwd)" + +echo "======================================" +echo "SecuBox AppStore Update Deployment" +echo "======================================" +echo "" +echo "Build directory: $BUILD_DIR" +echo "Router: $ROUTER_USER@$ROUTER_IP" +echo "" + +# Step 1: Rebuild packages +echo "[1/5] Rebuilding packages..." +cd "$BUILD_DIR" + +if [ ! -f "./secubox-tools/local-build.sh" ]; then + echo "ERROR: local-build.sh not found!" + echo "Are you in the correct directory?" + exit 1 +fi + +./secubox-tools/local-build.sh secubox-core luci-app-secubox-admin + +echo "" +echo "✓ Packages rebuilt successfully" +echo "" + +# Step 2: Find built packages +echo "[2/5] Locating built packages..." + +SECUBOX_CORE_PKG=$(find bin/packages/*/secubox -name "secubox-core_*.ipk" | sort -V | tail -1) +SECUBOX_ADMIN_PKG=$(find bin/packages/*/secubox -name "luci-app-secubox-admin_*.ipk" | sort -V | tail -1) + +if [ -z "$SECUBOX_CORE_PKG" ] || [ -z "$SECUBOX_ADMIN_PKG" ]; then + echo "ERROR: Could not find built packages!" + echo "Expected packages in: bin/packages/*/secubox/" + exit 1 +fi + +echo "Found:" +echo " - $SECUBOX_CORE_PKG" +echo " - $SECUBOX_ADMIN_PKG" +echo "" + +# Step 3: Copy to router +echo "[3/5] Copying packages to router..." + +scp "$SECUBOX_CORE_PKG" "$SECUBOX_ADMIN_PKG" "$ROUTER_USER@$ROUTER_IP:/tmp/" + +echo "" +echo "✓ Packages copied to router /tmp/" +echo "" + +# Step 4: Install on router +echo "[4/5] Installing packages on router..." + +ssh "$ROUTER_USER@$ROUTER_IP" << 'ENDSSH' +set -e + +cd /tmp + +echo "Installing secubox-core..." +opkg install --force-reinstall secubox-core_*.ipk + +echo "Installing luci-app-secubox-admin..." +opkg install --force-reinstall luci-app-secubox-admin_*.ipk + +echo "" +echo "Installed packages:" +opkg list-installed | grep secubox | grep -E "(secubox-core|luci-app-secubox-admin)" + +echo "" +echo "Restarting RPCD..." +/etc/init.d/rpcd restart + +echo "" +echo "Verifying ACL file..." +if [ -f /usr/share/rpcd/acl.d/luci-app-secubox-admin.json ]; then + echo "✓ ACL file exists" + if grep -q "get_catalog_sources" /usr/share/rpcd/acl.d/luci-app-secubox-admin.json; then + echo "✓ ACL contains new methods" + else + echo "⚠ ACL file missing new methods!" + fi +else + echo "✗ ACL file not found!" +fi + +echo "" +echo "Cleaning up /tmp..." +rm -f /tmp/secubox-core_*.ipk /tmp/luci-app-secubox-admin_*.ipk + +ENDSSH + +echo "" +echo "✓ Packages installed on router" +echo "" + +# Step 5: Verify +echo "[5/5] Verifying installation..." + +ssh "$ROUTER_USER@$ROUTER_IP" << 'ENDSSH' +echo "Testing RPC methods..." + +# Test catalog sources +if ubus -S call luci.secubox get_catalog_sources 2>&1 | grep -q "sources"; then + echo "✓ get_catalog_sources works" +else + echo "✗ get_catalog_sources failed" +fi + +# Test check updates +if ubus -S call luci.secubox check_updates 2>&1 | grep -qE "updates|{"; then + echo "✓ check_updates works" +else + echo "✗ check_updates failed" +fi + +ENDSSH + +echo "" +echo "======================================" +echo "Deployment Complete!" +echo "======================================" +echo "" +echo "Next steps:" +echo "1. Clear your browser cache (Ctrl+Shift+R)" +echo "2. Reload the LuCI admin interface" +echo "3. Navigate to Admin Control → Catalog Sources or Updates" +echo "" +echo "If issues persist:" +echo "- Check browser console for errors" +echo "- Verify ACL permissions: ssh $ROUTER_USER@$ROUTER_IP 'cat /usr/share/rpcd/acl.d/luci-app-secubox-admin.json'" +echo "- Test RPC: ssh $ROUTER_USER@$ROUTER_IP 'ubus -S call luci.secubox get_catalog_sources'" +echo ""