标签:为例 openwrt19.07 LUCI 编译 PKG INSTALL ser2net luci DIR
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
//定义包的Luci位置;
define Package/ser2net
SECTION:=net
CATEGORY:=Network
TITLE:=Serial to Network Proxy
URL:=https://sourceforge.net/projects/ser2net/
endef
//包描述
define Package/ser2net/description
This project provides a proxy that allows telnet/tcp connections to be made to
serial ports on a machine.
endef
//定义包的配置文件
define Package/ser2net/conffiles
/etc/config/ser2net
/etc/ser2net.conf
endef
//安装相关文件到相对应的位置;
define Package/ser2net/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ser2net $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc
$(INSTALL_CONF) ./files/ser2net.conf $(1)/etc/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/ser2net.config $(1)/etc/config/ser2net
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/ser2net.init $(1)/etc/init.d/ser2net
endef
$(eval $(call BuildPackage,ser2net))
并在该目录下建立配置文件files目录,建立三个配置文件
ser2net.conf ->运行参数配置文件
ser2net.config ->web配置文件参数
ser2net.init ->启动配置文件
2、luci相关内容编译;
(1)文件目录结构
htdocs -> luci-status->resources->view->ser2net->
leds.js //三个页面的js文件;
proxies.js
settings.js
po ->翻译文件信息;
root ->usr/share/luci-> menu.d ->luci.app-ser2net.json 文件,该文件确定的文件菜单位置,以及菜单页调用的view文件名;
{
"admin/services/ser2net": {
"title": "ser2net",
"action": {
"type": "firstchild"
},
"depends": {
"acl": [ "luci-app-ser2net" ],
"uci": { "ser2net": true }
}
},
"admin/services/ser2net/settings": {
"title": "Settings",
"order": 1,
"action": {
"type": "view",
"path": "ser2net/settings"
}
},
"admin/services/ser2net/proxies": {
"title": "Proxies",
"order": 2,
"action": {
"type": "view",
"path": "ser2net/proxies"
}
},
"admin/services/ser2net/leds": {
"title": "LEDs",
"order": 3,
"action": {
"type": "view",
"path": "ser2net/leds"
}
}
}
->usr/share/rpcd/acl.d -> luci-app-ser2net.json
{
"luci-app-ser2net": {
"description": "Grant access to LuCI app ser2net",
"read": {
"uci": [ "ser2net" ]
},
"write": {
"uci": [ "ser2net" ]
}
}
}
(1)编译Makefile 文件内容
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI Support for ser2net
LUCI_DEPENDS:=+ser2net
PKG_LICENSE:=Apache-2.0
include ../../luci.mk
相应内容在luci/luci.mk文件里
拷贝以上htdocs,root,以及po文件内容到相应位置;
define Package/$(PKG_NAME)/install
if [ -d $(PKG_BUILD_DIR)/luasrc ]; then \
$(INSTALL_DIR) $(1)$(LUCI_LIBRARYDIR); \
cp -pR $(PKG_BUILD_DIR)/luasrc/* $(1)$(LUCI_LIBRARYDIR)/; \
$(FIND) $(1)$(LUCI_LIBRARYDIR)/ -type f -name '*.luadoc' | $(XARGS) rm; \
$(if $(CONFIG_LUCI_SRCDIET),$(call SrcDiet,$(1)$(LUCI_LIBRARYDIR)/),true); \
$(call SubstituteVersion,$(1)$(LUCI_LIBRARYDIR)/); \
else true; fi
if [ -d $(PKG_BUILD_DIR)/htdocs ]; then \
$(INSTALL_DIR) $(1)$(HTDOCS); \
cp -pR $(PKG_BUILD_DIR)/htdocs/* $(1)$(HTDOCS)/; \
$(if $(CONFIG_LUCI_JSMIN),$(call JsMin,$(1)$(HTDOCS)/),true); \
$(if $(CONFIG_LUCI_CSSTIDY),$(call CssTidy,$(1)$(HTDOCS)/),true); \
else true; fi
if [ -d $(PKG_BUILD_DIR)/root ]; then \
$(INSTALL_DIR) $(1)/; \
cp -pR $(PKG_BUILD_DIR)/root/* $(1)/; \
else true; fi
if [ -d $(PKG_BUILD_DIR)/src ]; then \
$(call Build/Install/Default) \
$(CP) $(PKG_INSTALL_DIR)/* $(1)/; \
else true; fi
endef
标签:为例,openwrt19.07,LUCI,编译,PKG,INSTALL,ser2net,luci,DIR 来源: https://blog.51cto.com/13300270/2620010
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。