add: luci-app-baidupcs-mipsle
This commit is contained in:
parent
6e4bb7a6fc
commit
bab9fc7ab6
72
package/cnsztl/luci-app-baidupcs-mipsle/Makefile
Executable file
72
package/cnsztl/luci-app-baidupcs-mipsle/Makefile
Executable file
@ -0,0 +1,72 @@
|
||||
#
|
||||
# Copyright (C) 2016-2017 WindTech <admin@windtech.top>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-baidupcs
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=WindTech <admin@windtech.top>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=LuCI Support for BaiduPCS-Go FOR MIPSLE ONLY
|
||||
PKGARCH:=all
|
||||
# DEPENDS:=+baidupcs-go
|
||||
DEPENDS:=+wget +openssl-util
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
LuCI Support for BaiduPCS-Go FOR MIPSLE ONLY.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(foreach po,$(wildcard ${CURDIR}/files/luci/i18n/*.po), \
|
||||
po2lmo $(po) $(PKG_BUILD_DIR)/$(patsubst %.po,%.lmo,$(notdir $(po)));)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
( . /etc/uci-defaults/luci-baidupcs ) && rm -f /etc/uci-defaults/luci-baidupcs
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/baidupcs
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
|
||||
$(INSTALL_DATA) ./files/luci/i18n/baidupcs.zh-cn.lmo $(1)/usr/lib/lua/luci/i18n/baidupcs.zh-cn.lmo
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
|
||||
$(INSTALL_DATA) ./files/luci/controller/baidupcs.lua $(1)/usr/lib/lua/luci/controller/baidupcs.lua
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/baidupcs
|
||||
$(INSTALL_DATA) ./files/luci/model/cbi/baidupcs.lua $(1)/usr/lib/lua/luci/model/cbi/baidupcs.lua
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/etc/config/baidupcs $(1)/etc/config/baidupcs
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/etc/init.d/baidupcs $(1)/etc/init.d/baidupcs
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/luci-baidupcs $(1)/etc/uci-defaults/luci-baidupcs
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
6
package/cnsztl/luci-app-baidupcs-mipsle/files/etc/config/baidupcs
Executable file
6
package/cnsztl/luci-app-baidupcs-mipsle/files/etc/config/baidupcs
Executable file
@ -0,0 +1,6 @@
|
||||
|
||||
config baidupcs 'config'
|
||||
option port '5299'
|
||||
option enabled '0'
|
||||
option path '/mnt/sda1/baidupcs'
|
||||
|
||||
24
package/cnsztl/luci-app-baidupcs-mipsle/files/etc/init.d/baidupcs
Executable file
24
package/cnsztl/luci-app-baidupcs-mipsle/files/etc/init.d/baidupcs
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2015 By Wind
|
||||
|
||||
START=90
|
||||
STOP=90
|
||||
|
||||
start() {
|
||||
config_load baidupcs
|
||||
enabled=$(uci get baidupcs.config.enabled)
|
||||
port=$(uci get baidupcs.config.port)
|
||||
path=$(uci get baidupcs.config.path)
|
||||
|
||||
[ "$enabled" == "1" ] || return
|
||||
|
||||
if [ ! -f "$path/baidupcs" ];then
|
||||
wget -O $path/baidupcs https://openwrt-cdn.netlify.com/download/bin/mipsle/baidupcs-go && cd $path && ./baidupcs web --port $port --access >/dev/null 2>/dev/null &
|
||||
else
|
||||
$path/baidupcs web --port $port --access >/dev/null 2>/dev/null &
|
||||
fi
|
||||
}
|
||||
|
||||
stop() {
|
||||
killall baidupcs >/dev/null 2>/dev/null &
|
||||
}
|
||||
11
package/cnsztl/luci-app-baidupcs-mipsle/files/etc/uci-defaults/luci-baidupcs
Executable file
11
package/cnsztl/luci-app-baidupcs-mipsle/files/etc/uci-defaults/luci-baidupcs
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@baidupcs[-1]
|
||||
add ucitrack baidupcs
|
||||
set ucitrack.@baidupcs[-1].init=baidupcs
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
11
package/cnsztl/luci-app-baidupcs-mipsle/files/luci/controller/baidupcs.lua
Executable file
11
package/cnsztl/luci-app-baidupcs-mipsle/files/luci/controller/baidupcs.lua
Executable file
@ -0,0 +1,11 @@
|
||||
module("luci.controller.baidupcs", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/baidupcs") then
|
||||
return
|
||||
end
|
||||
local page
|
||||
page = entry({"admin", "services", "baidupcs"}, cbi("baidupcs"), _("Baidupcs Setting"), 100)
|
||||
page.i18n = "baidupcs"
|
||||
page.dependent = true
|
||||
end
|
||||
BIN
package/cnsztl/luci-app-baidupcs-mipsle/files/luci/i18n/baidupcs.zh-cn.lmo
Executable file
BIN
package/cnsztl/luci-app-baidupcs-mipsle/files/luci/i18n/baidupcs.zh-cn.lmo
Executable file
Binary file not shown.
37
package/cnsztl/luci-app-baidupcs-mipsle/files/luci/model/cbi/baidupcs.lua
Executable file
37
package/cnsztl/luci-app-baidupcs-mipsle/files/luci/model/cbi/baidupcs.lua
Executable file
@ -0,0 +1,37 @@
|
||||
require("luci.sys")
|
||||
require("luci.util")
|
||||
require("luci.model.ipkg")
|
||||
local fs = require "nixio.fs"
|
||||
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
|
||||
local m, s
|
||||
|
||||
local running=(luci.sys.call("pidof baidupcs > /dev/null") == 0)
|
||||
|
||||
local button = ""
|
||||
local state_msg = ""
|
||||
local trport = uci:get_first("baidupcs", "config", "port") or 5299
|
||||
if running then
|
||||
button = " <input type=\"button\" value=\" " .. translate("Open Baidupcs Web Interface") .. " \" onclick=\"window.open('http://'+window.location.hostname+':" .. trport .. "')\"/>"
|
||||
end
|
||||
|
||||
if running then
|
||||
state_msg = "<b><font color=\"green\">" .. translate("Baidupcs running") .. "</font></b>"
|
||||
else
|
||||
state_msg = "<b><font color=\"red\">" .. translate("Baidupcs not running") .. "</font></b>"
|
||||
end
|
||||
|
||||
m = Map("baidupcs", translate("Baidupcs"), translate("Baidupcs is a simple web base baidu netdisk, here you can configure the settings.") .. button
|
||||
.. "<br/><br/>" .. translate("Baidupcs Run Status").. " : " .. state_msg .. "<br/>")
|
||||
|
||||
s = m:section(TypedSection, "baidupcs", "")
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
enable = s:option(Flag, "enabled", translate("Enable"))
|
||||
enable.rmempty = false
|
||||
|
||||
port=s:option(Value, "port", translate("listen port"))
|
||||
path=s:option(Value, "path", translate("path"))
|
||||
return m
|
||||
Loading…
Reference in New Issue
Block a user