luci-app-baidupcs-mipsle:fix error | add luci-app-filebrowser-mipsle

This commit is contained in:
CN_SZTL 2019-06-07 00:20:34 +08:00
parent bab9fc7ab6
commit beb6688739
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
8 changed files with 188 additions and 24 deletions

View File

@ -1,24 +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 &
}
#!/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 &
}

View 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-filebrowser
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 FileBrowser FOR MIPSLE ONLY
PKGARCH:=all
# DEPENDS:=+filebrowser
DEPENDS:=+wget +openssl-util
endef
define Package/$(PKG_NAME)/description
LuCI Support for FileBrowser 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-filebrowser ) && rm -f /etc/uci-defaults/luci-filebrowser
fi
exit 0
endef
define Package/$(PKG_NAME)/conffiles
/etc/config/filebrowser
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
$(INSTALL_DATA) ./files/luci/i18n/filebrowser.zh-cn.lmo $(1)/usr/lib/lua/luci/i18n/filebrowser.zh-cn.lmo
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
$(INSTALL_DATA) ./files/luci/controller/filebrowser.lua $(1)/usr/lib/lua/luci/controller/filebrowser.lua
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/filebrowser
$(INSTALL_DATA) ./files/luci/model/cbi/filebrowser.lua $(1)/usr/lib/lua/luci/model/cbi/filebrowser.lua
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/etc/config/filebrowser $(1)/etc/config/filebrowser
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/etc/init.d/filebrowser $(1)/etc/init.d/filebrowser
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/etc/uci-defaults/luci-filebrowser $(1)/etc/uci-defaults/luci-filebrowser
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@ -0,0 +1,7 @@
config filebrowser 'config'
option enabled '0'
option port '8989'
option scope '/'
option path '/mnt/sda1/filebrowser'

View File

@ -0,0 +1,25 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2015 By Wind
START=91
STOP=91
start() {
config_load filebrowser
enabled=$(uci get filebrowser.config.enabled)
port=$(uci get filebrowser.config.port)
path=$(uci get filebrowser.config.path)
scope=$(uci get filebrowser.config.scope)
[ "$enabled" == "1" ] || return
if [ ! -f "$path/filebrowser" ];then
wget -O $path/filebrowser https://openwrt-cdn.netlify.com/download/bin/mipsle/filebrowser && cd $path && ./filebrowser --port $port --scope $scope >/dev/null 2>/dev/null &
else
cd $path && ./filebrowser --port $port --scope $scope >/dev/null 2>/dev/null &
fi
}
stop() {
killall filebrowser >/dev/null 2>/dev/null &
}

View File

@ -0,0 +1,11 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@filebrowser[-1]
add ucitrack filebrowser
set ucitrack.@filebrowser[-1].init=filebrowser
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -0,0 +1,11 @@
module("luci.controller.filebrowser", package.seeall)
function index()
if not nixio.fs.access("/etc/config/filebrowser") then
return
end
local page
page = entry({"admin", "services", "filebrowser"}, cbi("filebrowser"), _("FileBrowser"), 100)
page.i18n = "filebrowser"
page.dependent = true
end

View File

@ -0,0 +1,38 @@
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 filebrowser > /dev/null") == 0)
local button = ""
local state_msg = ""
local trport = uci:get_first("filebrowser", "config", "port") or 8989
if running then
button = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"button\" value=\" " .. translate("Open FileBrowser Web Interface") .. " \" onclick=\"window.open('http://'+window.location.hostname+':" .. trport .. "')\"/>"
end
if running then
state_msg = "<b><font color=\"green\">" .. translate("FileBrowser running") .. "</font></b>"
else
state_msg = "<b><font color=\"red\">" .. translate("FileBrowser not running") .. "</font></b>"
end
m = Map("filebrowser", translate("FileBrowser"), translate("FileBrowser is a simple web base file browser, here you can configure the settings.") .. button
.. "<br/><br/>" .. translate("FileBrowser Run Status").. " : " .. state_msg .. "<br/>")
s = m:section(TypedSection, "filebrowser", "")
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"))
scope_dir=s:option(Value, "scope", translate("scope dir"))
return m