mirror of
https://github.com/mkschreder/juci.git
synced 2025-01-07 03:16:39 +08:00
juci: add example standalone plugin. Building standalone juci packages has been possible from the start. However there has been no examples of using this feature in the main repo. This example shows how.
Basically you have to create a new openwrt package for your plugin. You can use the template. Then you can create a symlink from this package src folder (actual plugin code) to plugins/your-plugin-name in your working juci directory. This will allow you to easily work on the new standalone package within your juci workspace even though it's source is located outside of the main source tree.
This commit is contained in:
parent
b36f77025e
commit
5237d5197d
50
example-standalone-plugin/Makefile
Normal file
50
example-standalone-plugin/Makefile
Normal file
@ -0,0 +1,50 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=juci-example-standalone
|
||||
PKG_VERSION:=0.0.1
|
||||
PKG_RELEASE:=$(PKG_VERSION)
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
PKG_BUILD_DEPENDS := juci
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/juci-example-standalone
|
||||
SECTION:=juci
|
||||
CATEGORY:=JUCI
|
||||
TITLE:=JUCI Standalone Plugin Example
|
||||
URL:=https://github.com/mkschreder/juci
|
||||
MAINTAINER:=Martin K. Schröder <mkschreder.uk@gmail.com>
|
||||
SUBMENU:=Plugins
|
||||
endef
|
||||
|
||||
define Package/juci-example-standalone/description
|
||||
An example showing how to build standalone plugin packages in juci.
|
||||
endef
|
||||
|
||||
define Package/juci-example-standalone/config
|
||||
depends on PACKAGE_juci
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
make -C $(STAGING_DIR)/usr/src/juci/ MODULE=$(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Package/juci-example-standalone/install
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/* $(1)/
|
||||
endef
|
||||
|
||||
define Package/juci-example-standalone/postinst
|
||||
#!/bin/sh
|
||||
# run this only during image building stage
|
||||
[ -n "$${IPKG_INSTROOT}" ] && $${STAGING_DIR}/usr/src/juci/juci-update $${IPKG_INSTROOT}/www/
|
||||
# otherwise just run normal version
|
||||
[ -z "$${IPKG_INSTROOT}" ] && juci-update
|
||||
exit 0
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,juci-example-standalone))
|
11
example-standalone-plugin/src/access.json
Normal file
11
example-standalone-plugin/src/access.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"example-stand-alone": {
|
||||
"description": "JUCI Standalone Plugin Example",
|
||||
"read": {
|
||||
"uci": [ "whatever" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "whatever" ]
|
||||
}
|
||||
}
|
||||
}
|
13
example-standalone-plugin/src/po/en.po
Normal file
13
example-standalone-plugin/src/po/en.po
Normal file
@ -0,0 +1,13 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: en\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.7.5\n"
|
||||
|
@ -0,0 +1,6 @@
|
||||
<juci-layout-with-sidebar>
|
||||
<div ng-controller="exampleStandAlone">
|
||||
<juci-config-heading>{{ 'Standalone Page' | translate }}</juci-config-heading>
|
||||
<p translate>Hello World!</p>
|
||||
</div>
|
||||
</juci-layout-with-sidebar>
|
@ -0,0 +1,5 @@
|
||||
|
||||
JUCI.app
|
||||
.controller("exampleStandAlone", function($scope, $uci, $network, $tr, gettext){
|
||||
|
||||
});
|
Loading…
Reference in New Issue
Block a user