Initial commit: SecuBox v1.0.0 - fixed packages makefiles

This commit is contained in:
CyberMind-FR 2025-12-22 16:13:16 +01:00
parent ca90702f6f
commit 9bad706ec6
14 changed files with 273 additions and 283 deletions

View File

@ -22,7 +22,7 @@ on:
architectures: architectures:
description: 'Architectures to build (comma-separated or "all")' description: 'Architectures to build (comma-separated or "all")'
required: false required: false
default: 'x86-64' default: 'aarch64-cortex-a72'
env: env:
OPENWRT_VERSION: ${{ github.event.inputs.openwrt_version || '23.05.5' }} OPENWRT_VERSION: ${{ github.event.inputs.openwrt_version || '23.05.5' }}

0
cleanup-packages.sh Normal file → Executable file
View File

97
fix-makefiles.sh Normal file
View File

@ -0,0 +1,97 @@
#!/bin/bash
# fix-makefiles.sh
# Script to fix Makefiles for OpenWrt LuCI packages
set -e
echo "🔧 SecuBox Makefile Fixer"
echo "========================="
echo ""
FIXED=0
SKIPPED=0
for makefile in luci-app-*/Makefile; do
if [[ ! -f "$makefile" ]]; then
continue
fi
PKG_DIR=$(dirname "$makefile")
PKG_NAME=$(basename "$PKG_DIR")
echo "📦 Processing: $PKG_NAME"
# Check if already has luci.mk include
if grep -q 'include.*feeds/luci/luci\.mk' "$makefile"; then
echo " ✅ Already has luci.mk include"
SKIPPED=$((SKIPPED + 1))
continue
fi
# Check if has package.mk include (alternative valid format)
if grep -q 'include.*package\.mk' "$makefile" && grep -q 'BuildPackage' "$makefile"; then
echo " ✅ Uses package.mk with BuildPackage (valid)"
SKIPPED=$((SKIPPED + 1))
continue
fi
# Need to fix - create backup first
cp "$makefile" "${makefile}.bak"
# Extract existing values
PKG_VERSION=$(grep "^PKG_VERSION:=" "$makefile" | cut -d'=' -f2 || echo "1.0.0")
PKG_RELEASE=$(grep "^PKG_RELEASE:=" "$makefile" | cut -d'=' -f2 || echo "1")
PKG_LICENSE=$(grep "^PKG_LICENSE:=" "$makefile" | cut -d'=' -f2 || echo "Apache-2.0")
LUCI_TITLE=$(grep "^LUCI_TITLE:=" "$makefile" | cut -d'=' -f2- || echo "LuCI - $PKG_NAME")
LUCI_DEPENDS=$(grep "^LUCI_DEPENDS:=" "$makefile" | cut -d'=' -f2- || echo "+luci-base")
# If no LUCI_TITLE, try to extract from define Package section
if [[ -z "$LUCI_TITLE" || "$LUCI_TITLE" == "LuCI - $PKG_NAME" ]]; then
TITLE_LINE=$(grep -A5 "define Package/" "$makefile" | grep "TITLE" | head -1 | cut -d'=' -f2-)
if [[ -n "$TITLE_LINE" ]]; then
LUCI_TITLE="$TITLE_LINE"
fi
fi
# Generate new Makefile
cat > "$makefile" << MAKEFILE_EOF
include \$(TOPDIR)/rules.mk
PKG_NAME:=${PKG_NAME}
PKG_VERSION:=${PKG_VERSION:-1.0.0}
PKG_RELEASE:=${PKG_RELEASE:-1}
PKG_LICENSE:=${PKG_LICENSE:-Apache-2.0}
PKG_MAINTAINER:=CyberMind <contact@cybermind.fr>
LUCI_TITLE:=${LUCI_TITLE:-LuCI - SecuBox Module}
LUCI_DEPENDS:=${LUCI_DEPENDS:-+luci-base}
LUCI_PKGARCH:=all
include \$(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildance
MAKEFILE_EOF
echo " 🔧 Fixed Makefile (backup: ${makefile}.bak)"
FIXED=$((FIXED + 1))
done
echo ""
echo "========================="
echo "📊 Summary"
echo "========================="
echo "Fixed: $FIXED"
echo "Skipped: $SKIPPED"
echo ""
if [[ $FIXED -gt 0 ]]; then
echo "⚠️ Review the fixed Makefiles and adjust LUCI_TITLE and LUCI_DEPENDS as needed"
echo ""
echo "📝 Example correct values:"
echo " LUCI_TITLE:=LuCI - CrowdSec Security Dashboard"
echo " LUCI_DEPENDS:=+luci-base +rpcd +curl"
fi
echo ""
echo "✅ Done!"

View File

@ -1,49 +1,16 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-auth-guardian PKG_NAME:=luci-app-auth-guardian
PKG_VERSION:=1.0.0 PKG_VERSION:=2.0.0
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=CyberMind <contact@cybermind.fr> PKG_MAINTAINER:=CyberMind <contact@cybermind.fr>
PKG_LICENSE:=MIT
include $(INCLUDE_DIR)/package.mk LUCI_TITLE:=LuCI - Auth Guardian (Captive Portal & OAuth)
LUCI_DESCRIPTION:=Authentication system with captive portal, OAuth2 (Google, GitHub), voucher management, and session control for SecuBox.
LUCI_DEPENDS:=+luci-base +rpcd +curl +nodogsplash
LUCI_PKGARCH:=all
define Package/luci-app-auth-guardian include $(TOPDIR)/feeds/luci/luci.mk
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=3. Applications
TITLE:=Auth Guardian - Authentication & Session Manager
DEPENDS:=+luci-base +rpcd +nodogsplash
PKGARCH:=all
endef
define Package/luci-app-auth-guardian/description # call BuildPackage - OpenWrt buildroot
Comprehensive authentication and session management:
- Captive portal with customizable splash pages
- OAuth2/OIDC integration (Google, GitHub, etc.)
- Cookie-based session management
- MAC authentication bypass
- Voucher/ticket system
- Time-based access control
- User/device tracking
endef
define Build/Compile
endef
define Package/luci-app-auth-guardian/install
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
$(INSTALL_BIN) ./root/usr/libexec/rpcd/luci.auth-guardian $(1)/usr/libexec/rpcd/
$(INSTALL_DIR) $(1)/usr/share/luci/menu.d
$(INSTALL_DATA) ./root/usr/share/luci/menu.d/*.json $(1)/usr/share/luci/menu.d/
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
$(INSTALL_DATA) ./root/usr/share/rpcd/acl.d/*.json $(1)/usr/share/rpcd/acl.d/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./root/etc/config/authguard $(1)/etc/config/
$(INSTALL_DIR) $(1)/www/luci-static/resources/view/auth-guardian
$(INSTALL_DATA) ./htdocs/luci-static/resources/view/auth-guardian/*.js $(1)/www/luci-static/resources/view/auth-guardian/
$(INSTALL_DIR) $(1)/www/luci-static/resources/auth-guardian
$(INSTALL_DATA) ./htdocs/luci-static/resources/auth-guardian/*.js $(1)/www/luci-static/resources/auth-guardian/
endef
$(eval $(call BuildPackage,luci-app-auth-guardian))

View File

@ -1,53 +1,16 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-bandwidth-manager PKG_NAME:=luci-app-bandwidth-manager
PKG_VERSION:=1.0.0 PKG_VERSION:=2.0.0
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=CyberMind <contact@cybermind.fr> PKG_MAINTAINER:=CyberMind <contact@cybermind.fr>
PKG_LICENSE:=MIT
include $(INCLUDE_DIR)/package.mk LUCI_TITLE:=LuCI - Bandwidth Manager (QoS & Quotas)
LUCI_DESCRIPTION:=Advanced bandwidth management with CAKE QoS, per-client quotas, automatic media detection, and traffic scheduling for SecuBox.
LUCI_DEPENDS:=+luci-base +rpcd +tc-full +kmod-sched-cake +sqm-scripts
LUCI_PKGARCH:=all
define Package/luci-app-bandwidth-manager include $(TOPDIR)/feeds/luci/luci.mk
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=3. Applications
TITLE:=Bandwidth Manager - QoS, Quotas & Media Detection
DEPENDS:=+luci-base +rpcd +tc +kmod-sched-cake +kmod-sched-fq-codel
PKGARCH:=all
endef
define Package/luci-app-bandwidth-manager/description # call BuildPackage - OpenWrt buildroot
Advanced bandwidth management for OpenWrt with:
- Per-client and per-group quotas (daily/monthly)
- Bandwidth throttling and shaping
- 8-level QoS priority classes
- Automatic media detection (VoIP, Gaming, Streaming)
- Time-based scheduling
- Real-time statistics and graphs
endef
define Build/Compile
endef
define Package/luci-app-bandwidth-manager/install
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
$(INSTALL_BIN) ./root/usr/libexec/rpcd/luci.bandwidth-manager $(1)/usr/libexec/rpcd/
$(INSTALL_DIR) $(1)/usr/share/luci/menu.d
$(INSTALL_DATA) ./root/usr/share/luci/menu.d/*.json $(1)/usr/share/luci/menu.d/
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
$(INSTALL_DATA) ./root/usr/share/rpcd/acl.d/*.json $(1)/usr/share/rpcd/acl.d/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./root/etc/config/bandwidth $(1)/etc/config/
$(INSTALL_DIR) $(1)/www/luci-static/resources/view/bandwidth-manager
$(INSTALL_DATA) ./htdocs/luci-static/resources/view/bandwidth-manager/*.js $(1)/www/luci-static/resources/view/bandwidth-manager/
$(INSTALL_DIR) $(1)/www/luci-static/resources/bandwidth-manager
$(INSTALL_DATA) ./htdocs/luci-static/resources/bandwidth-manager/*.js $(1)/www/luci-static/resources/bandwidth-manager/
endef
define Package/luci-app-bandwidth-manager/postinst
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/rpcd reload
endef
$(eval $(call BuildPackage,luci-app-bandwidth-manager))

View File

@ -1,48 +1,16 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-media-flow PKG_NAME:=luci-app-media-flow
PKG_VERSION:=1.0.0 PKG_VERSION:=2.0.0
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=CyberMind <contact@cybermind.fr> PKG_MAINTAINER:=CyberMind <contact@cybermind.fr>
PKG_LICENSE:=MIT
include $(INCLUDE_DIR)/package.mk LUCI_TITLE:=LuCI - Media Flow (Streaming Detection)
LUCI_DESCRIPTION:=Real-time streaming service detection and monitoring for Netflix, YouTube, Twitch, Zoom, Teams with quality indicators for SecuBox.
LUCI_DEPENDS:=+luci-base +rpcd +netifyd
LUCI_PKGARCH:=all
define Package/luci-app-media-flow include $(TOPDIR)/feeds/luci/luci.mk
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=3. Applications
TITLE:=Media Flow - Streaming & Media Detection
DEPENDS:=+luci-base +rpcd +netifyd
PKGARCH:=all
endef
define Package/luci-app-media-flow/description # call BuildPackage - OpenWrt buildroot
Advanced media and streaming traffic detection:
- Real-time protocol identification (RTSP, HLS, DASH)
- Streaming service detection (Netflix, YouTube, Twitch)
- VoIP/Video call identification (Zoom, Teams, Meet)
- Media quality monitoring
- Bandwidth allocation for media
- Content type classification
endef
define Build/Compile
endef
define Package/luci-app-media-flow/install
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
$(INSTALL_BIN) ./root/usr/libexec/rpcd/luci.media-flow $(1)/usr/libexec/rpcd/
$(INSTALL_DIR) $(1)/usr/share/luci/menu.d
$(INSTALL_DATA) ./root/usr/share/luci/menu.d/*.json $(1)/usr/share/luci/menu.d/
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
$(INSTALL_DATA) ./root/usr/share/rpcd/acl.d/*.json $(1)/usr/share/rpcd/acl.d/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./root/etc/config/mediaflow $(1)/etc/config/
$(INSTALL_DIR) $(1)/www/luci-static/resources/view/media-flow
$(INSTALL_DATA) ./htdocs/luci-static/resources/view/media-flow/*.js $(1)/www/luci-static/resources/view/media-flow/
$(INSTALL_DIR) $(1)/www/luci-static/resources/media-flow
$(INSTALL_DATA) ./htdocs/luci-static/resources/media-flow/*.js $(1)/www/luci-static/resources/media-flow/
endef
$(eval $(call BuildPackage,luci-app-media-flow))

View File

@ -1,48 +1,16 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-vhost-manager PKG_NAME:=luci-app-vhost-manager
PKG_VERSION:=1.0.0 PKG_VERSION:=2.0.0
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=CyberMind <contact@cybermind.fr> PKG_MAINTAINER:=CyberMind <contact@cybermind.fr>
PKG_LICENSE:=MIT
include $(INCLUDE_DIR)/package.mk LUCI_TITLE:=LuCI - VHost Manager (Reverse Proxy & SSL)
LUCI_DESCRIPTION:=Virtual host manager for local services like Nextcloud, GitLab, Jellyfin with nginx reverse proxy and automatic SSL certificates for SecuBox.
LUCI_DEPENDS:=+luci-base +rpcd +nginx-ssl +acme +acme-acmesh
LUCI_PKGARCH:=all
define Package/luci-app-vhost-manager include $(TOPDIR)/feeds/luci/luci.mk
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=3. Applications
TITLE:=VHost Manager - Virtual Hosts & Local SaaS
DEPENDS:=+luci-base +rpcd +nginx +dnsmasq
PKGARCH:=all
endef
define Package/luci-app-vhost-manager/description # call BuildPackage - OpenWrt buildroot
Virtual host and local SaaS management:
- Internal virtual hosts configuration
- External service redirection to local alternatives
- Self-hosted SaaS deployment (Nextcloud, GitLab, etc.)
- DNS-based traffic interception
- SSL certificate management
- Reverse proxy configuration
endef
define Build/Compile
endef
define Package/luci-app-vhost-manager/install
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
$(INSTALL_BIN) ./root/usr/libexec/rpcd/luci.vhost-manager $(1)/usr/libexec/rpcd/
$(INSTALL_DIR) $(1)/usr/share/luci/menu.d
$(INSTALL_DATA) ./root/usr/share/luci/menu.d/*.json $(1)/usr/share/luci/menu.d/
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
$(INSTALL_DATA) ./root/usr/share/rpcd/acl.d/*.json $(1)/usr/share/rpcd/acl.d/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./root/etc/config/vhost $(1)/etc/config/
$(INSTALL_DIR) $(1)/www/luci-static/resources/view/vhost-manager
$(INSTALL_DATA) ./htdocs/luci-static/resources/view/vhost-manager/*.js $(1)/www/luci-static/resources/view/vhost-manager/
$(INSTALL_DIR) $(1)/www/luci-static/resources/vhost-manager
$(INSTALL_DATA) ./htdocs/luci-static/resources/vhost-manager/*.js $(1)/www/luci-static/resources/vhost-manager/
endef
$(eval $(call BuildPackage,luci-app-vhost-manager))

View File

@ -0,0 +1,16 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-auth-guardian
PKG_VERSION:=2.0.0
PKG_RELEASE:=1
PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=CyberMind <contact@cybermind.fr>
LUCI_TITLE:=LuCI - Auth Guardian (Captive Portal & OAuth)
LUCI_DESCRIPTION:=Authentication system with captive portal, OAuth2 (Google, GitHub), voucher management, and session control for SecuBox.
LUCI_DEPENDS:=+luci-base +rpcd +curl +nodogsplash
LUCI_PKGARCH:=all
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot

View File

@ -0,0 +1,16 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-bandwidth-manager
PKG_VERSION:=2.0.0
PKG_RELEASE:=1
PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=CyberMind <contact@cybermind.fr>
LUCI_TITLE:=LuCI - Bandwidth Manager (QoS & Quotas)
LUCI_DESCRIPTION:=Advanced bandwidth management with CAKE QoS, per-client quotas, automatic media detection, and traffic scheduling for SecuBox.
LUCI_DEPENDS:=+luci-base +rpcd +tc-full +kmod-sched-cake +sqm-scripts
LUCI_PKGARCH:=all
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot

View File

@ -0,0 +1,16 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-media-flow
PKG_VERSION:=2.0.0
PKG_RELEASE:=1
PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=CyberMind <contact@cybermind.fr>
LUCI_TITLE:=LuCI - Media Flow (Streaming Detection)
LUCI_DESCRIPTION:=Real-time streaming service detection and monitoring for Netflix, YouTube, Twitch, Zoom, Teams with quality indicators for SecuBox.
LUCI_DEPENDS:=+luci-base +rpcd +netifyd
LUCI_PKGARCH:=all
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot

View File

@ -0,0 +1,16 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-secubox
PKG_VERSION:=2.0.0
PKG_RELEASE:=1
PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=CyberMind <contact@cybermind.fr>
LUCI_TITLE:=LuCI - SecuBox Hub (Central Dashboard)
LUCI_DESCRIPTION:=Central control hub for all SecuBox modules. Provides unified dashboard, module status, system health monitoring, and quick actions.
LUCI_DEPENDS:=+luci-base +rpcd +curl +jq
LUCI_PKGARCH:=all
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot

View File

@ -0,0 +1,16 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-vhost-manager
PKG_VERSION:=2.0.0
PKG_RELEASE:=1
PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=CyberMind <contact@cybermind.fr>
LUCI_TITLE:=LuCI - VHost Manager (Reverse Proxy & SSL)
LUCI_DESCRIPTION:=Virtual host manager for local services like Nextcloud, GitLab, Jellyfin with nginx reverse proxy and automatic SSL certificates for SecuBox.
LUCI_DEPENDS:=+luci-base +rpcd +nginx-ssl +acme +acme-acmesh
LUCI_PKGARCH:=all
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot

BIN
secubox-makefile-fixes.zip Normal file

Binary file not shown.

View File

@ -1,128 +1,75 @@
# SecuBox LuCI Application Makefile Template # Template Makefile for SecuBox LuCI Applications
# Copyright (C) 2025 CyberMind.fr # ================================================
# SPDX-License-Identifier: Apache-2.0 # Copy this template and customize for each package
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
# ============================================ # Package metadata
# Package Information PKG_NAME:=luci-app-PACKAGE_NAME
# ============================================ PKG_VERSION:=2.0.0
PKG_NAME:=luci-app-TEMPLATE-dashboard
PKG_VERSION:=1.0.0
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_LICENSE:=Apache-2.0 PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=Gandalf <contact@cybermind.fr> PKG_MAINTAINER:=CyberMind <contact@cybermind.fr>
# ============================================ # LuCI specific
# LuCI Configuration LUCI_TITLE:=LuCI - Package Description
# ============================================ LUCI_DESCRIPTION:=Detailed description of what this package does
LUCI_TITLE:=LuCI TEMPLATE Dashboard LUCI_DEPENDS:=+luci-base
LUCI_DESCRIPTION:=Dashboard for TEMPLATE on OpenWrt
LUCI_DEPENDS:=+luci-base +TEMPLATE
LUCI_PKGARCH:=all LUCI_PKGARCH:=all
# Optional: Extra dependencies # Include LuCI build system
# +luci-lib-jsonc +rpcd +uhttpd
include $(TOPDIR)/feeds/luci/luci.mk include $(TOPDIR)/feeds/luci/luci.mk
# ============================================ # Call BuildPackage - this is handled by luci.mk
# Package Definition # No need for explicit Package/xxx/install when using luci.mk
# ============================================
define Package/$(PKG_NAME)
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=3. Applications
TITLE:=$(LUCI_TITLE)
DEPENDS:=$(LUCI_DEPENDS)
PKGARCH:=$(LUCI_PKGARCH)
endef
define Package/$(PKG_NAME)/description # === END OF TEMPLATE ===
$(LUCI_DESCRIPTION)
Features: # ================================================
- Real-time status monitoring # NOTES FOR DEVELOPERS
- Configuration management # ================================================
- Interactive dashboard #
- System integration # Directory structure expected by luci.mk:
endef #
# luci-app-mypackage/
# ============================================ # ├── Makefile # This file
# Installation # ├── htdocs/
# ============================================ # │ └── luci-static/
define Package/$(PKG_NAME)/install # │ └── resources/
# JavaScript views # │ └── view/
$(INSTALL_DIR) $(1)/www/luci-static/resources/view/TEMPLATE # │ └── mypackage/
$(INSTALL_DATA) ./htdocs/luci-static/resources/view/TEMPLATE/*.js \ # │ └── main.js # LuCI JavaScript view
$(1)/www/luci-static/resources/view/TEMPLATE/ # └── root/
# ├── etc/
# API and CSS # │ ├── config/
$(INSTALL_DIR) $(1)/www/luci-static/resources/TEMPLATE # │ │ └── mypackage # UCI config file
$(INSTALL_DATA) ./htdocs/luci-static/resources/TEMPLATE/*.js \ # │ ├── init.d/
$(1)/www/luci-static/resources/TEMPLATE/ # │ │ └── mypackage # Init script (executable)
$(INSTALL_DATA) ./htdocs/luci-static/resources/TEMPLATE/*.css \ # │ └── uci-defaults/
$(1)/www/luci-static/resources/TEMPLATE/ # │ └── 99-mypackage # First-run setup (executable)
# └── usr/
# Menu configuration # ├── libexec/
$(INSTALL_DIR) $(1)/usr/share/luci/menu.d # │ └── rpcd/
$(INSTALL_DATA) ./root/usr/share/luci/menu.d/$(PKG_NAME).json \ # │ └── mypackage # RPCD backend script (executable)
$(1)/usr/share/luci/menu.d/ # └── share/
# ├── luci/
# ACL configuration # │ └── menu.d/
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d # │ └── luci-app-mypackage.json # Menu entry
$(INSTALL_DATA) ./root/usr/share/rpcd/acl.d/$(PKG_NAME).json \ # └── rpcd/
$(1)/usr/share/rpcd/acl.d/ # └── acl.d/
# └── luci-app-mypackage.json # ACL permissions
# RPCD backend #
$(INSTALL_DIR) $(1)/usr/libexec/rpcd # ================================================
$(INSTALL_BIN) ./root/usr/libexec/rpcd/TEMPLATE \ # COMMON LUCI_DEPENDS OPTIONS
$(1)/usr/libexec/rpcd/ # ================================================
#
# UCI default config (optional) # +luci-base - Required for all LuCI apps
$(INSTALL_DIR) $(1)/etc/config # +luci-compat - Legacy API compatibility
$(INSTALL_CONF) ./root/etc/config/TEMPLATE \ # +luci-lib-jsonc - JSON-C library
$(1)/etc/config/ # +rpcd - RPC daemon (for backend scripts)
# +curl - HTTP client
# UCI defaults (optional - runs on first install) # +jq - JSON processor
# $(INSTALL_DIR) $(1)/etc/uci-defaults # +wireguard-tools - WireGuard utilities
# $(INSTALL_BIN) ./root/etc/uci-defaults/$(PKG_NAME) \ # +qrencode - QR code generator
# $(1)/etc/uci-defaults/ #
endef # ================================================
# ============================================
# Post-installation
# ============================================
define Package/$(PKG_NAME)/postinst
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] || {
# Reload rpcd to register new methods
/etc/init.d/rpcd reload 2>/dev/null || true
# Clear LuCI cache
rm -rf /tmp/luci-modulecache 2>/dev/null || true
rm -rf /tmp/luci-indexcache* 2>/dev/null || true
echo "$(PKG_NAME) installed successfully"
}
exit 0
endef
define Package/$(PKG_NAME)/postrm
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] || {
# Reload rpcd
/etc/init.d/rpcd reload 2>/dev/null || true
# Clear LuCI cache
rm -rf /tmp/luci-modulecache 2>/dev/null || true
rm -rf /tmp/luci-indexcache* 2>/dev/null || true
}
exit 0
endef
# ============================================
# Build
# ============================================
$(eval $(call BuildPackage,$(PKG_NAME)))