fix(repo): Add postinst script to configure opkg feeds automatically

- Auto-create repo directories on install
- Detect device architecture and configure customfeeds.conf
- Add prerm script to cleanup on uninstall
- Points opkg to local repo at 192.168.255.1:8888

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-03-18 10:33:50 +01:00
parent 9cd59b77ba
commit c152934bf1

View File

@ -50,6 +50,20 @@ endef
define Package/secubox-app-repo/postinst
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] || {
# Create repo directory
mkdir -p /srv/repo.secubox.in/luci /srv/repo.secubox.in/packages
# Get device architecture
ARCH=$$(opkg print-architecture | grep -v 'all' | tail -1 | awk '{print $$2}')
# Configure opkg custom feed
cat > /etc/opkg/customfeeds.conf << FEEDS
# SecuBox Package Repository (local)
src secubox_luci http://192.168.255.1:8888/luci/$${ARCH}
src secubox_packages http://192.168.255.1:8888/packages/$${ARCH}
FEEDS
# Start services
/etc/init.d/repo-server enable
/etc/init.d/repo-server start
/etc/init.d/rpcd restart
@ -57,4 +71,14 @@ define Package/secubox-app-repo/postinst
exit 0
endef
define Package/secubox-app-repo/prerm
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] || {
/etc/init.d/repo-server stop
/etc/init.d/repo-server disable
rm -f /etc/opkg/customfeeds.conf
}
exit 0
endef
$(eval $(call BuildPackage,secubox-app-repo))